Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
10-10-2011, 08:34 PM #1
- Join Date
- Oct 2011
- Thanked 0 Times in 0 Posts
E-commerce prevent form submit help
I am using an e-commerce solution to run my web business. The checkout portion of the website is COMPLETELY closed off to me and I can't access the files.
What I currently have is a series of radio buttons built into the checkout process. It displays 20 options and the customer has to choose which one of the twenty options applies to them. Each customer only has 2 valid options to choose from based on their zip code, but currently the other zip code shipping options are listed as well.
10-10-2011, 09:38 PM #2
A better solution would be, in addition to the JS based validation, that your <form> submits to some server-side code on your site (PHP/ASP/JSP) that does server-side validation (so it repeats the JS validation, just in case) and only then forwards the <form> data to the checkout process.
Instead, just use an ordinary button
<input type="button" value="Submit order" onclick="validateAndSend(this.form);" />
And change your validation so that it, in turn, calls the form's submit() method only if the validation is fully passed.
DO NOT HAVE ANY OTHER WAY of submitting the form.
Now, even if the JS code encounters an error, it won't reach the bottom of the validation where you call the submit() method, so the form won't get submitted.
About as safe as you can get without server-side validation.
If you would show us some code, we could make more comments on how good (or bad) your validation is and help you with it. But no code, no way for us to help more.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.