|
|
You can incorporate this validation feature into any existing form, any number of times. The form elements must be named consistently so the script can work with them. To set up a ranked-list survey question as in the examples above, name the <select>s as q + the number of the question + a, b, c, etc. In this case, the form elements are named: q1a To use the validation, call rankem(a,b) where the parameters are the question number and its length. In this case, the form handler calls the function twice: rankem(1,4); Each call will generate a separate alert if there's anything amiss. The global "badrank" variable is a status flag so the main form handler knows if it's allowed to submit(). Note that this demo doesn't acutally do a submit(); instead it just displays a message.
|
|
|||||||
[ Contact Us! ] [ JavaScript Forum ] [ Submit Your Script! ]
|
|||||||
Comments feed