Post a form page to itself and change the URL
Posted on 2006-11-02
My challenge is to have a wizard-like interface. That is, a 5 step process. Each step is a page with a series of form fields on it. All form fields are submitted to the next page until the last step where everything is submitted for processing.
I have written plenty of wizards before so no need to delve into the how-to's of carrying form fields over, etc.
Here's my specific challange for this task; it's all about the URL shown for each page (step).
I would like the URL to show the step we are on.
But here's the hard part:
I must Submit and validate the fields of each step before moving to the next page/step. If there is a failure in the validation, I want to show the same page again (with the same URL). If validation is successful, I want to show the next page with the next page's URL.
I am submitting my page to itself so I can check for errors, if there are erros, I simply redisplay the same page; but if all is well, I need to be able to get to the next page and change the URL. Typically I would do this with a <CFLOCATION URL=""> but that won't take all the form fields with me..
It seems to me this requires some type of double submit, once for validating (because if it fails I can just "drop through" to the original page), and then a follow-up form post to change the URL.
Alternatively, if I can change while the page is drawing, but I don't think that's possible :)
My goal is to do this without cookies or session variables.