Computer Science Canada check box and radio dial javascript validation |
Author: | johnwboyd [ Mon Apr 06, 2009 10:28 am ] |
Post subject: | check box and radio dial javascript validation |
I'm wondering if you can help me as to how to validate a drop check box and radio dial with this page: http://johnwboyd.net/templates08/car-loan1/2/ and it's js: http://johnwboyd.net/templates08/car-loan1/2/form.js How would I validate it in PHP as well? http://johnwboyd.net/templates08/car-loan1/2/form.php Also how would I add field validation to that script such as email, address, and so on? Thanks in advance! |
Author: | jeffgreco13 [ Mon Apr 06, 2009 9:55 pm ] | ||
Post subject: | Re: check box and radio dial javascript validation | ||
i highly suggest you look into jQuery or Prototype... using one of these frameworks you can cut down the amount of javascript coding. As you can tell validating radio buttons can be quite obtrusive in javascript:
So i suggest you look into a JS framework. For speed purposes you're better off validating your required fields using JS. Just to make sure your users enter information. Then usin PHP validate the content. Phone number length, email, etc. etc. Check out this tutorial for PHP: Sanitize Email |
Author: | DtY [ Tue May 12, 2009 3:09 pm ] |
Post subject: | Re: check box and radio dial javascript validation |
jeffgreco13 @ Mon Apr 06, 2009 9:55 pm wrote: For speed purposes you're better off validating your required fields using JS. Just to make sure your users enter information. Then usin PHP validate the content. Phone number length, email, etc. etc.
Validate all information server side. And if you wish to, check client side as well so the user knows right away if they enter something bad. The reason to check everything on the server side is that it can't be stopped, whereas doing it client side, you can shut javascript off, or send a fake http request, and you get bad data in your database. |