Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How can I set a text field to convert all text entered to upper case when populated?

Avatar

Level 2

I want to have all entered text populated into specific text fields to automatically convert to upper case. I am working in LiveCycle Designer ES2.

1 Accepted Solution

Avatar

Correct answer by
Level 2

I am not sure how to place the code to get it working. Cannot get it to work.

View solution in original post

34 Replies

Avatar

Level 4

Hi,

Place the following code in the change event of textfield to make the input in upper case

xfa.event.change=xfa.event.change.toUpperCase();

Hope it helps

Avatar

Level 2

Thank you for your assistance.

Where is the change event to place the code? I pasted the code into the function area but it did nothing.

Joe

Avatar

Level 2

Cannot open the document using the link. Says my Adobe cannot support the document. I have Adobe Reader X and Acrobat Pro X installed on my computer.

Avatar

Level 2

Thank you. All working now. Had a wrong setting before.

Avatar

Level 2

Thanks again. Can this code work for Proper case if I just change the code text from UpperCase to ProperCase?

Avatar

Level 4

Use the below code on exit event of textfield

if (!(this.isNull || this.rawValue == "")) {

      var str = this.rawValue;

     var char1 = str.substring(0,1);

     var char2_n = str.substring(1,str.length);

      this.rawValue = char1.toUpperCase() + char2_n.toLowerCase();

}

Thanks,

Vipin

Avatar

Level 2

Thank you. Works only for the first word. All words after the first word remain in all lower case. The fields being populated contain names of organizations and all first letters of the major words need to be capitalized. Also will be used for fields populating names of people if it works so both first and last names will need to be proper case.

Avatar

Level 4

You shouls use this script

function capitalizeEachWord(str)

{

   var words = str.split(" ");

   var arr = Array();

   for (i in words)

   {

      temp = words[i].toLowerCase();

      temp = temp.charAt(0).toUpperCase() + temp.substring(1);

      arr.push(temp);

   }

   return arr.join(" ");

}

and call as

upper.rawValue= js.capitalizeEachWord(this.rawValue);

Also i have uploaded the PDF

https://workspaces.acrobat.com/?d=54*PMvnV4z9bIjJ5siGiEw

Thanks,

Vipin

Avatar

Level 2

I cannot open the link to see the code as PDF. I wish I knew what Adobe version I need since I have Reader X and Acrobat Pro X installed.

Avatar

Correct answer by
Level 2

I am not sure how to place the code to get it working. Cannot get it to work.

Avatar

Level 4

I have attached the screenshot of both the places (i.e., where i used the script)that will help you to use this script into your form.

1. On js variable

screen1.jpg

2. On exit event of textfield1

screen2.jpg

Thanks,

Vipin

Avatar

Level 2

Thank you. I just cannot see how to enter the js variable as it appears in your screenshot. I see no option to enter variable and cannot change the text from subform to variable in the function area.

Avatar

Level 4

It seems you are facing issue while creating Script object(js).To create a new script object, right-click on the order object at the top of your form hierarchy. Select Insert Script Object from the pop-up menu. A new script object appears below the Validation script object.

script_Object.jpg

Thanks,

Vipin

Avatar

Level 2

Thank you. Got the views matching yours but still does not work for the Proper Case. Your Change Case document with the two text fields even does not work to Proper case.

Avatar

Level 4

It seems you are missing something, please share your email ID i'll send the working form.

Thanks,

Vipin

Avatar

Level 4

Please check your mail, i have shared the form.

Steps to use the form.

1. Open the PDF form

2. Type something in the textfield1.

3. Press tab key.

4. You will find the result in the textfield2.

Thanks,

Vipin

Avatar

Level 2

Thank you. I am trying to get the entered text to auto change to Proper case without being moved to a different text field. That does not help my form. I need the entered text to change within the same field. I cannot be adding extra text fields just to change the case.

Anyway, it is just a wish and maybe it is not possible to do.

Thank you for your assistance.