2 Replies Latest reply on Dec 14, 2009 1:22 AM by kragoth

    how to change the input value to upper case

      hi every one


      i want to change the all user input into upper case, even if they are type with out caps lock on. for that i use the input style like this


      input[type=submit], input[type=button] {
           font-size: 10px;
           margin: 5px 5px 5px 0;
           cursor: pointer;
              text-transform: uppercase;
      }
       



      it is working in the view page , but in back end i am getting the lower case data.
      is there any other easy way to convert all the user input into upper case.


      thiagu.m

        • 1. Re: how to change the input value to upper case
          xsalefter.xsalefter.yahoo.com

          You can just add


          stringValue.toUpperCase();



          in your conttoller/backing bean/EntityHome persist/update method. After all, this is explain in Java SE docs as a natural String object capability.

          • 2. Re: how to change the input value to upper case
            kragoth

            The text-transform only applies to how the data is 'DISPLAYED' to the user. It does not affect the data sent back to the server.


            I'm doing exactly what you want to do with this small jQuery function.


            function upperCaseAllInputs() {
                 jQuery("input:not('.normalCase')[type='text']")
                      .each(function() {this.value = this.value.toUpperCase();});
            }
            



            I just call this during the onsubmit of each page. (Getting it to work will be hard if you are using ajax but... see how you go.