Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How I can validate a inputbox?

Status
Not open for further replies.

jjmew

Programmer
Aug 20, 2002
34
0
0
US
I am using the CFINPUT tag to add a date to my database, the date format in my table is YYYY-MM-DD, and cfinput just validates this formats MM-DD-YYYY and DD-MM-YYYY. What I can do to make sure that the user is entering the right format? please help me
 
You'd probably have to write your own javascript validator.

This is all CFINPUT really does anyway... so, if you don't know a lot about javascript, one method would certainly be to build the page with the CFINPUT validating to MM-DD-YYYY, open it in your browser and view source, copy the javascript and the now *INPUT* tag, paste the javascript back into your code then adjust it to validate the format you want (should be fairly easy).

Then replace the CFINPUT in your code with the INPUT you copied from the view source. It should have the newly revised function already called from a onX event.

Reload the page in your browser, and you should be in business.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top