Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

jQuery or PHP

Options
  • 01-11-2012 11:15pm
    #1
    Registered Users Posts: 1,298 ✭✭✭


    Hey guys, what would you use to validate your forms?

    JQuery or php scripting?


Comments

  • Registered Users Posts: 5,246 ✭✭✭conor.hogan.2


    Both. You definitely should not be doing it all locally or all on the server.


  • Registered Users Posts: 1,298 ✭✭✭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


  • Registered Users Posts: 2,100 ✭✭✭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.


  • Registered Users Posts: 586 ✭✭✭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.


  • Registered Users Posts: 26,571 ✭✭✭✭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)


  • Advertisement
  • Registered Users Posts: 1,657 ✭✭✭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.


Advertisement