View Full Version : Input validation

09-15-2008, 05:49 AM
I have seen something similar to this in the threads, but tried my own version and it doesn't seem to be working. I have attached my script, if I could get a little help. Thank you.

1. Create a cross-browser (works in Firefox and MS IE) input screen that takes in a client’s information for an order:
* Full Name (text field)
* Address (textarea)
* Gender (radio button)
* Date of birth (three dropdown lists – day, month, year)
* “Send me newsletter” (checkbox)
* Hidden total value for order (hidden field)
* “Submit Order” button (button).
2. When the user is done with input, validate using the rules below:
* At least 3 characters required in name
* Must be over 18 years old
* Gender must be selected
3. If validation passes, show the information in an alert box and write ‘Your order has been submitted’. Otherwise, alert the user with the appropriate validation error and set focus on the input field that failed validation.

09-16-2008, 05:21 AM
Get firebug (https://addons.mozilla.org/en-US/firefox/addon/1843). You'll see that the errors are common mistakes of not closing your function and disability to declare your variables.