View Full Version : Help with form validation
Brainthief
04-22-2009, 11:18 AM
I think my problems posted in the two threads below are the same:
http://www.webassist.com/forums/showthread.php?t=613
http://www.webassist.com/forums/showthread.php?t=644
I think my form is not posting to the correct page.
I added server side form validation to checkout.php with the form action posting back to checkout.php to preform the validation...
Validation is working fine. My rules are working as they should.
The problem is in moving on the the confirm page...
Where on the validation page (checkout.php), after validation, does the page get sent on to confirm.php?
Ray Borduin
04-22-2009, 11:19 AM
Change the form action back to go to the confirm page and copy and paste your validation code from the top of the checkout page to the top of the confirm page and you should be good to go.
Brainthief
04-22-2009, 01:01 PM
I see...
I think that's what I needed!
Thanks Ray...
Brainthief
04-22-2009, 03:36 PM
That looks like what I needed to know, but...
I'm using a template system and I'm calling my pages like this:
index.php?page=checkout
If a user inputs something wrong on the index.php?page=checkout form,
it goes to index.php?page=confirm where it fails validation.
It should send the user back to index.php?page=checkout to correct the fields, but it sends the user back to index.php?page=Checkout&page=Confirm
This sends the user on to the confirm page which is wrong.
How do I keep it from adding &page=confirm to the query string?
Thanks!
Ray Borduin
04-22-2009, 03:48 PM
On the page WAVT_Scripts_PHP.php it has code that automatically adds querystring variables to the end of the url. It is on lines 64-70. You could probably comment out that code, or better yet create a copy of the function and add it to your page so that you can comment out a local version and don't need to update the central include.
It is sometimes necessary to maintain the url parameters on update pages, so it is done automatically. I hesitate to have you remove it from the global function in case you ever use validation on an update page. Also reapplying the server behavior would overwrite the file.
Brainthief
04-22-2009, 03:54 PM
I see!
That's what I needed to know
Again Ray, Thank you.
I appreciate you working with me on this.
I think I'm moving forward now!
Brainthief
04-22-2009, 06:50 PM
Alright, maybe another easy one.
I'm not getting a "stop" at confirm.php page...
Everything seems to be working with UPS and Paypal but after validation, it rolls right on to checkout_success.php.
I see the order in the database.
Shouldn't the process stop at confirm.php so the user can click the "Submit Order" button, then continue on to checkout_success.php?
Thanks!
Ray Borduin
04-23-2009, 07:39 AM
Yes it should. Perhaps you are using the "any form submit" trigger to insert the order and process the transaction, so the submit from the checkout page immediately triggers the insert without confirmation. That is one possible cause of what you describe.
Brainthief
04-23-2009, 11:12 AM
Yes, you are correct - I have any form post selected.
I got tis from the docs;
"Any Form Post: Any form posted to the page that the server behavior is applied to will trigger validation. This is typically used when a form on a different page is submitted to the page for validation."
I tired all of the other choices in the drop drop down and got the same results.
I checked the dynamic options but was not sure where to start...
Can you tell me which option I should choose?
Thanks!
Ray Borduin
04-23-2009, 12:32 PM
Use the button press trigger event that triggers based on the name of the button used to submit the form and make sure the button names on your checkout and confirm page are not the same. That way you can differentiate when each server behavior triggers.
Brainthief
04-23-2009, 06:04 PM
I found these post :
http://www.webassist.com/forums/showthread.php?t=630&highlight=button+press+trigger
http://www.webassist.com/forums/showthread.php?t=630&highlight=button+press+trigger
But I don't understand the concept...
where is the button press trigger?
How do I add the button press trigger?
what page do I add the button press trigger to?
on the confirm page where I have the validation, the drop down has undefined button press and Submit_order button press.
My button names are not the same.
on confirm.php the button name is: Submit_order
on checkout.php the button name is checkout
Thanks for a little bigger hint on this one...
Thanks!
Ray Borduin
04-24-2009, 07:17 AM
In the bindings tab, click the plus button to add the form from the checkout page.
For the trigger, click the lightning bolt and choose the button from the newly added form.
Brainthief
04-24-2009, 11:08 AM
Could this be something else?
The form was already added from the bindings tab.
What is the difference between the buttons checkout_x and checkout_y?
I also added the confirm.php form and tried confirm_x and confirm_y buttons.
Any button selected automatically confirms and sends me to checkout_success.php?
Do you have any other ideas?
This has to be something i've done... something simple?
Thanks again!
Ray Borduin
04-24-2009, 11:22 AM
Try using completely different names for the buttons like Checkout and ConfirmCheckout.
Brainthief
04-24-2009, 04:37 PM
Thanks,
I changed the names and still the same.
Should I kill server side validation?
Ray Borduin
04-24-2009, 06:33 PM
Post a support incident. You can share your files with someone from our support team and they will spot the problem. Without looking at your files I can only make guesses.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.