PDA

View Full Version : what's better for validating forms?


n8w
7-3-05, 01:24 PM
Okay .. better for validating forms .. php or javascript .. here is the type of information I need to validate

form example (http://www.n8w.com/temp/form.gif)

thanks a ton
n8w

ticoroman
7-3-05, 04:01 PM
A combination of those 2. JavaScript runs on client side and can be turned off, which means it's not reliable to 100%.

n8w
7-3-05, 04:06 PM
the thing is .. I think I can do everything with php .. so I was wondering if there is any reason to use javascript that I don't know about

satis
7-3-05, 09:28 PM
I don't ever use javascript for form validation. The only negative is you have to have a page refresh to do php validation....javascript validation can happen in real-time on the client side. But, since you can't trust javascript, it's really only useful to make things easier on the clients. PHP is where your true validation should be (at least in my opinion).

RTH10260
7-3-05, 10:26 PM
Okay .. better for validating forms .. php or javascript .. here is the type of information I need to validate

form example (http://www.n8w.com/temp/form.gif) You will always need server side validation. Anything arriving from the net can be tainted and manipulated. It's essentially unsafe stuff.

Any client side validation you make, is an enhancement of the GUI and can help for a faster user interaction with the application. It may reduce the number of user errors when filling in forms. Speed speed gain comes simply cause there is no client server interaction. Though that's the general case, in special cases the client side scripting could request additional information from the server to aid in user validation, but that usually involves less data transfer.

NMS
7-4-05, 02:04 PM
I don't ever use javascript for form validation. The only negative is you have to have a page refresh to do php validation....javascript validation can happen in real-time on the client side. But, since you can't trust javascript, it's really only useful to make things easier on the clients. PHP is where your true validation should be (at least in my opinion).
I disagree with you on this one. There is only why reason why you should use javascript is beacuse you are lazy or you do not know php or validation is not so important ;)

Therefore use php.