Script47 Posted August 12, 2013 Posted August 12, 2013 So I was wondering if you suggest validating user input using PHP only or JS only, or using both? Quote
Alan Posted August 12, 2013 Posted August 12, 2013 What guest said - both. JS to save a trip to the server (and thus conserve resources, bandwidth, time etc) PHP (or the language of your choice) on the backend to fully validate *all* input ensuring you duplicate what was done at JS level (after all, your client's JS may be disabled, or worse) With care, you can write decent forms that are essentially self-validating at both layers. Quote
Guest Posted August 12, 2013 Posted August 12, 2013 To help with the JS validation, think about storing things in the data attribute, quite possibly the best plugin I have found for this is http://jqueryvalidation.org/ , of course you can choose to write it yourself. Quote
Script47 Posted August 12, 2013 Author Posted August 12, 2013 PHP (or the language of your choice) on the backend to fully validate *all* input ensuring you duplicate what was done at JS level (after all, your client's JS may be disabled, or worse) That's what I thought, doing both. But thought I would clarify. To help with the JS validation, think about storing things in the data attribute, quite possibly the best plugin I have found for this is http://jqueryvalidation.org/ , of course you can choose to write it yourself. Will look in to it, thanks. :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.