Per Jessen wrote:
Terion Miller wrote:
I have a huge form to validate and wonder which is better javascript
validation or php, the page is a php page, I actually put js
validation on it but then it stopped working (stopped inserting into
the db) not sure if that had anything to do with it....
What does everyone prefer?
I don't think it's about the developer preference, it's about the user.
Javascript enables lots of checking at data entry time, and can improve
the overall user experience. If you're not particularly concerned with
the user experience, don't bother with javascript.
/Per Jessen, Zürich
where as I think validation always needs to happen at the server side;
each application or script should be self contained, it needs to check
that the data it recieves is valid before working with it; if it is not
valid it needs to inform the system that sent it the data is not valid.
The system that sent it in this case is the html output; so you need a
method of displaying errors in the html.
That is the bare minimum and always needed.
As for making the experience nicer; javascript is good for this; it can
be used to pre-validate input on the way in to the system; but should
not be relied upon as it can be turned off, stop functioning due to
another faulty javascript on the page or simply not be supported by the
client. You still need the server side validation though.
So.. more of a case of always validate server side; and should / do you
want to use javascript validation in addition.
IMHO :p
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php