Validation after form submitting..

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Basically, im redesigning a form page on our website.

Currently the user submits the form, it does a few javascript checks
and either submits to the "processstuff.php" page, or gives the user a
JS error message.. where they have to go back and fill the details in.

Im trying to optimise and make this form/page as best as it can be.

Do you think it would be a better idea to continue using JS or use JS
then submit to the php page(where it checks some other details(postcode
validation) and submits, or just solely use php validation?

Im open to ideas please.


Re: Validation after form submitting..

Advo wrote:
Quoted text here. Click to load it

The best is always to do both:
1. JS validation will inform the user instantly that something is not OK,
and it will save him a trip to the server and back: better for the user,
less load on the server: a win-win.
2. JS validation can easily be bypassed or JS can be disabled by the user,
so always, always, check again with PHP on the server itself.

Rik Wasmus

Re: Validation after form submitting..

Quoted text here. Click to load it

Remember, spammers, bots, viruses, and other nasties tend not to
use Javascript.  And anyone can turn it off.

Quoted text here. Click to load it

You *MUST* use php validation for security.  Javascript is useful
for excluding users who refuse to turn it on or don't know how to
turn it on, and it can make the page a bit friendlier.

Re: Validation after form submitting..

You can use AJAX with PHP, by AJAX make the php validation without
refreshing the page, after submitting do the validation again for
security. This is more friendly for users, and you can use php power
all the time.. (JS have a lot of bugs, use PHP cause of that)..
You can find a 5 minute tutorial at :

Re: Validation after form submitting..

NurAzije wrote:
Quoted text here. Click to load it

And AJAX fails to call PHP validation if the user has JS disabled -  
which is a big reason for having PHP validation in the first place!

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Validation after form submitting..

Gordon Burditt wrote:
Quoted text here. Click to load it

Yea i get what you mean and see why its needed really.

This is how im thinking it should go in my head:

user submits form > JS checks If valid > next page, if not valid > go
back(msgbox), THEN send form variables to php processing page (store as
session) > Perform php validation > if false, return to the page and
put the session variables in the form fields so they dont need to  fill
it in all again?  

That about right?

Site Timeline