Basically I want to display a confirmation page when the model data is valid and the record has been saved. The problem I have is that I don’t wish to expose any id/model data in the URL. So for example the form is at URL:
This renders views/site/quote.php
My confirmation page is views/site/thanks.php
So the URL of the confirmation should ideally be (/localhost/quote), or have its own URL/action (/localhost/thanks)
If I render the confirmation in the same action, then the form data can be re-submitted by reloading the page. And I prefer not to use sessions either.
If I render the confirmation in its own action, then how can I pass in model data without using GET variables or sessions?
I use different approaches to get the same result as you want but I will tell you one, you brainstorm a bit and you will see that you can actually develop better things.
I hide the information of the model in base64 encripted strings, saved in hidden fields as asp.net does to maintain the state of their fields. So, you call the hidden field the way you want and then have a chunk of silly data attached in front or at the back of the information you wish to hide, then, on form submission, you check the hidden field against the data at the server, get the decoded data and query the DB.
The problem is that the length of the data you plug at the front or at the back of the data you wish to encode must be always of same size if you don’t wish to work with SESSIONS but it is a good trick.
Hmm I didn’t think of that! So basically I create a new action (actionThanks) and then I need to check if there is a flash message present - if yes then render the thanks page - if no then redirect to actionQuote.
public function actionThanks()
The problem there is that when I make a call to hasFlash() in my controller action, this then deletes the flash message - so how can I pass on the flash message to my view file?