• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Font format change

Explorer ,
Apr 21, 2021 Apr 21, 2021

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? 

TOPICS
General troubleshooting , How to , JavaScript , PDF forms

Views

974

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Apr 21, 2021 Apr 21, 2021

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...

Votes

Translate

Translate
Community Expert , Apr 28, 2021 Apr 28, 2021

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

Votes

Translate

Translate
Apr 21, 2021 Apr 21, 2021

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.

 

- Dov Isaacs, former Adobe Principal Scientist (April 30, 1990 - May 30, 2021)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2021 Apr 21, 2021

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.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 21, 2021 Apr 21, 2021

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? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2021 Apr 21, 2021

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 27, 2021 Apr 27, 2021

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,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 27, 2021 Apr 27, 2021

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 28, 2021 Apr 28, 2021

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

LATEST

Thanks a lot, you are very helpful.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines