NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Devan on May 01, 2012, 10:21:58 PM

Title: Forcing validation on form button press
Post by: Devan on May 01, 2012, 10:21:58 PM
Hi all,

I've got a form that is just some memory variables, and I have a button that simply calls another web page when it is hit.

The problem is, The 4 memory fields need quote strict validation, i.e. required field, date checks etc., but it looks like none of these validations are being called when the button is being hit.

I changed the button type to 'Submit' but it still just goes to the other WebPage URL without running any validations.

Oh, and the validated fields start off hidden in the form until a checkbox is ticked.  They appear after the checkbox is ticked, but I don't know if the fact that they are hidden at the beginning of the WebForm is why they don't validate as normal?

Thanks,
Devan
Title: Re: Forcing validation on form button press
Post by: kevin plummer on May 01, 2012, 11:17:57 PM
Hi Devan,

Server Side code won't run if you have a URL on a button.

I'm wondering if you could just use the std save button which gives you the chance to validate the entries before leaving the form?

Kevin
Title: Re: Forcing validation on form button press
Post by: kevin plummer on May 01, 2012, 11:19:39 PM
The other option is to disable your button and set a session value to enable it once field level validation has been completed?
Title: Re: Forcing validation on form button press
Post by: Bruce on May 02, 2012, 02:40:22 AM
yes, I agree with Kevin;

Use the "Save" button to go to the next URL. This will validate all the fields on the form, so is the quickest approach.

Cheers
Bruce
Title: Re: Forcing validation on form button press
Post by: Devan on May 02, 2012, 03:11:04 AM
Thanks Kevin & Bruce!  I will do that.

I'll keep this tip in mind for future reference too - handy to know!  :)