Forums

validate field before submit

rodsdesign 08 Oct, 2009
Hi,

I have a form that needs a code input at the top in order to complete the rest of the form. obviously - I could do this in two forms... but is there a way to have this field validated in real time?

ie: to fill out the form, they must enter the code "8875" (for example). I would love if a message would pop up if they put the wrong code in (same as if they leave a field blank)

thanks!
GreyHead 08 Oct, 2009
Hi rodsdesign,

How do you know the code is valid? Is it a calculation or a database check, or something else?

Ajax is the obvious answer here - it's probably possible.

Bob
rodsdesign 08 Oct, 2009
Hey Bob,

I could set up the valid data in a table... I don't have that set up yet...

The form needs to require the code to be correct before the the form can be submitted. (its a quiz that can be taken only if they watched the whole video - the code is on the video at the very end) so the first field is the "code" field... I want it to check to see if the code is right before they can submit.

I can do the table set up - I'm not sure how to check that before submit.

hope that's enough info... thanks as always!
GreyHead 08 Oct, 2009
Hi rodsdesign,

If the code is always the same then check it in JavaScript - have the script enable or disable the submit button (or reveal the whole form if you prefer). If the audience is technically sophisticated then you might need to encrypt the code in the script to stop people hunting it down there.

Bob
rodsdesign 08 Oct, 2009
k...thanks

I don't know javascript at all... I'll search the forums to see if I can figure it out a bit...

thanks
This topic is locked and no more replies can be posted.