Viorel
January 29, 2024, 12:17pm
1
I wish to have a field where after users type in text, when clicking away or the next field, it auto-uppercases the text.
I tried the below but had no luck:
fd.field('JobNumber').$on('change', function(value) {
fd.field('JobNumber').value = value.toUpperCase()
})
If I auto-uppercase the text, will the uppercase version get pulled through to the worksheet as well, or will it still remain lower case.
Thanks,
Hello @Viorel ,
try this
fd.spRendered(() => {
fd.field("Title").$on("change", (val) => {
const upper = val.toUpperCase();
fd.field("Title").value = upper;
});
});
1 Like
Viorel
February 1, 2024, 9:58am
3
I would've thought that would work, but doesn't seem to.
I've changed 'Title' to our own field name, of course.
StepanS
February 1, 2024, 10:11am
4
Hello @Viorel
Well, the letters are still lowercase? Which data of field are you using? Single line of text? Is it a SharePoint field or Controls from Plumsail?
If you are using control, you should use:
// Instead of fd.field use line below
fd.control("TextField")
Or check developer console if there are any different errors that would block this line of code. If often happens when some code before does not execute and your line of code with "uppercasing" is ignored.
Viorel
February 1, 2024, 10:22am
6
Thank you for the help @StepanS !
1 Like
StepanS
February 1, 2024, 10:22am
7
Well do you use Public Forms? I thought you use Plumsail Forms for Onprem or Sharepoint Online. I am glad you solved it out
Viorel
February 1, 2024, 10:25am
8
It was a public form, not SharePoint.
Thank you for the help!
You're a star
Viorel
February 1, 2024, 10:27am
9
@StepanS How would I just capitalise the first letter in every word?
Essentially for a person's name.
I'm going to use this for a different form too
Viorel
February 1, 2024, 10:29am
10
This did the trick:
fd.rendered(() => {
fd.field("Name").$on("change", (val) => {
const upper = val.replace(/\b\w/g, (char) => char.toUpperCase());
fd.field("Name").value = upper;
});
});
StepanS
February 1, 2024, 10:31am
11
@Viorel Is this a question or have you already solved it?
1 Like
Viorel
February 1, 2024, 10:35am
12
Just solved now, sorry for confusion.
Added it above for others if they need this in the future.
1 Like