How can I set a text field to convert all text entered to upper case when populated? | Community
Skip to main content
New Participant
September 6, 2013
Solved

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

  • September 6, 2013
  • 34 replies
  • 28825 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by jcytrny

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

34 replies

jcytrnyAuthor
New Participant
September 12, 2013

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.

New Participant
September 9, 2013

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

2. On exit event of textfield1

Thanks,

Vipin

jcytrnyAuthorAccepted solution
New Participant
September 9, 2013

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

jcytrnyAuthor
New Participant
September 9, 2013

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.

New Participant
September 9, 2013

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

jcytrnyAuthor
New Participant
September 9, 2013

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.

New Participant
September 9, 2013

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

jcytrnyAuthor
New Participant
September 7, 2013

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

jcytrnyAuthor
New Participant
September 7, 2013

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

New Participant
September 7, 2013

I have attached the screenshot of the code