Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Development
jQuery or PHP
off.the.walls
Hey guys, what would you use to validate your forms?
JQuery or php scripting?
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
[Deleted User]
Both. You definitely should not be doing it all locally or all on the server.
off.the.walls
So how would I go about it, not to used to forms. Need to get it to gather all the data and forward it all in a mail too me so would I use jQuery to validate it and PHP to send it? or how would i go about it?
Thanks
ectoraige
Both, attaching greater importance to the php side. Validate *everything* on the server, never rely on the client to provide correct data. Validation on the client side should be done primarily to assist the user.
Aswerty
Validating on the server side (PHP) is vital so you can ensure the data is as expected. Validating on the client side (javascript/jQuery) is pretty much standard these days but it not a necessity, if you don't do it any invalid input message will be slow to appear because a round trip from client to server has to occur. If javascript is turned off the client side validation won't work and this is why it can't be used as the only point of validation. Typical rule of thumb to follow is anything coming from the client side is potentialy harmful.
With regards to client side validation you can use the excellent jQuery Validation plugin
http://docs.jquery.com/Plugins/Validation
.
So validate on client, validate on server then send email from the server.
Creamy Goodness
validate client side to convey to the user when something goes wrong.
validate server side to keep your balls out of the blender (figuratively speaking)
komodosp
Definitely PHP but also Javascript for usability.
PHP because it's possible to bypass the javascript validation, either with the browser or by not even visiting the page with the form. (You don't know how the form info got to you).
Javascript wherever possible because PHP validation means that the user will have to wait for the page to reload to find out they've entered something wrong - which is very annoying.