Copy link to clipboard
Copied
I have Text filed; I want to change my Text into Proper Case Format Whatever Input Upper- or Lower-Case Character Format.
Example: UNITED STATES will be = United States.
"mango" will be Mango.
How I will do this?
You can use this function I wrote to achieve it:
function toTitleCase(s) {
var words = s.split(" ");
for (var i in words)
words[i] = words[i].charAt(0).toUpperCase() + words[i].substr(1).toLowerCase();
return words.join(" ");
}
Note, however, that this code will turn "USA" into "Usa". If you don't want that to happen you can remove the .toLowerCase() part, but then if someone enters "WoW", it will remain like that...
Of course not, you didn't add the function itself as a doc-level script... I fixed it for you:
https://drive.google.com/file/d/1RA3XRFmeRW96_x9gMvG5ISJ9b3rrRptL/view?usp=sharing
Copy link to clipboard
Copied
There is absolutely no automatic way of doing this in Acrobat Pro. Conceivably you could write some script(s) and/or plug-in to do this, but the challenge would be selecting text (automatic for full document or page) versus highlighting and invoking a custom function.
Copy link to clipboard
Copied
++Adding to the discussion,
Seems like you're asking for a custom keystroke script or custom format script.
If I understood correctly, you need a condition to change to all lower case if the user paste or input a text string in that field to all upper case characters. But you also need to change the first character on each word(s) to upper case from lower case?
This may or may not be an easy task with JavaScript since you're dealing with a textfield object that seems to accept more than two words.
You also didn't specified if this field will also accept alphanumeric combinations (a word or words that may contain a mix of numbers or symbols altogether).
In any case, if you're letting the users type whatever they want in that textfield, the scripting will not be an easy task in order to achieve this purpose.
You're better off providing the users with a dropdown menu with the options that they need to choose from and then be able to fill in that texfield with the correct ortography that you intend. This will make it easier on the scripting part too if you choose to go this route.
Copy link to clipboard
Copied
My text field only contain text (a-z), Only applicant name includes this text filed.
Not alphanumeric combinations. Is it possible?
Copy link to clipboard
Copied
You can use this function I wrote to achieve it:
function toTitleCase(s) {
var words = s.split(" ");
for (var i in words)
words[i] = words[i].charAt(0).toUpperCase() + words[i].substr(1).toLowerCase();
return words.join(" ");
}
Note, however, that this code will turn "USA" into "Usa". If you don't want that to happen you can remove the .toLowerCase() part, but then if someone enters "WoW", it will remain like that...
Copy link to clipboard
Copied
I want to use Proper case /title case in particular text field only. Not Whole page.
How I will do this?
Thanks,
Copy link to clipboard
Copied
To use it for a specific field add the following to the field's custom calculation script, for example:
event.value = toTitleCase(event.value);
Copy link to clipboard
Copied
Sorry @try67 .
Not work.
I have attached sample file here.
https://drive.google.com/file/d/17MWGF2Rn3r2_a9CCn-8G-27rDD-Jo6yJ/view?usp=sharing
Copy link to clipboard
Copied
Of course not, you didn't add the function itself as a doc-level script... I fixed it for you:
https://drive.google.com/file/d/1RA3XRFmeRW96_x9gMvG5ISJ9b3rrRptL/view?usp=sharing
Copy link to clipboard
Copied
Thanks a lot, you are very helpful.