Jump to content

Change Form Data To Uppercase


johnnyg24
 Share

Recommended Posts

I am looking to change text input in a form to upper case before the form gets submitted. However, I don't think I can go about this in a normal .toUpperCase() method. I need to keep the text input 'name' the same and just change the actual value to upper case and then submit the form. Our data base is case sensitive and everything is in upper case.I would like the values to be changed to uppercase before the form gets submitted, not as the user is typing. I think that would confuse some users and they may think their Caps Lock button is not working properly.Any help would be appreciated.Here is a small piece of the form:

<form id="accApp" name="accApp" method="post" action="/webwiz/wwiz.asp?" onsubmit="return checkform();" > <input type="text" name="cName" size="100" value="" /><!--Need to change the value of "cName" to uppercase--><input type="submit" name="agree" value="Agree and Submit*" /></form>

Link to comment
Share on other sites

use CSS

input.uppercase{  text-transform: uppercase;  }

and then for the inputs that you want uppercase, have their class='uppercase'

<input type='text' class='uppercase' name='something'>

edit: sorry i see you want it done after... but do you want the user to see it transform when they hit the submit button? or when they exit the text field? or not see it transform at all?

Edited by smerny
Link to comment
Share on other sites

I don't want the user to see the transfermation at all. I would think an uppercase CSS could confuse some users and they may think their keyboard is not working properly. The form gets checked first by a validation script before getting submitted. I would put the upper case transfermation at the very end of this script. I would hope that after everything is validated the upper case function would work quickly enough that the user would never even see what happened and just think the form was submitted.

Link to comment
Share on other sites

you could do it server-side with asp (as it appears you have)you could use the Ucase() function on the string before submitting it to the db or sending an email or whatever you are doing with the stringotherwise with javascript you could use the toUpperCase() function

Edited by smerny
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...