How to Preserve Form Field Values When Back Button Pressed

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
thetallguy

How to Preserve Form Field Values When Back Button Pressed

Post by thetallguy »

Hi, again!  I'm looking for a way to preserve the values of a when the user submits but then hits the back button. 

Some detail: I've got a page with a that users fill out to get more information. When they click Submit, the form is sent to an external server where the fields are checked for completeness. If data is missing, they get an error message, and they have to click the Back button to return to the form.

On the old site (which was static) the form fields were still filled out when the users returned to the page. On the new site (CMSMS) the form is completely reset, meaning that the users have to fill the form out again from scratch.

It's a short form, so this isn't a fatal problem, but it is annoying.  I'd love to understand better conceptually why some forms retain their values when you return and others do not, but mostly I'd love some tips on how to handle my form differently so that the values are preserved.

Any ideas?

Thanks in advance for any help!
Michael
donnut

Re: How to Preserve Form Field Values When Back Button Pressed

Post by donnut »

I have exactly the same question.

Maybe there are two theoretical solutions. CMSMS generates the form from the database. One could try to store the values in the database and when the user hits the "back button", the values are restore from the database.
The other option could be that the form values are sort in cache. On each page there is an option to cache the page, but that does not seem to help in this case.

Hopefully there is somebody with some successful experience.

Thanks,
Erwin
Pierre M.

Re: How to Preserve Form Field Values When Back Button Pressed

Post by Pierre M. »

Hello,

Firstly, some CMSms unrelated stuf. The case is : FormPage.html has the FORM pointing to actionURL.php, the users fills some fields, submit the form and clic back. I think this is very actionURL.php dependant and browser dependant.
actionURL.php dependant :
If the method is POST actionURL.php may compute and "302 redirects" to GET ResultOfSubmit.php. So, when the user hits "back", does the browser go back to POST actionURL.php or to FormPage.html ?
browser dependant :
When rendering again FormPage.html, the browser may prefill fields depending of its features and configuration.
Now replace FormPage.html by FormPage.php which is able to decode the HTTP request to see if some fields are already valued... funny, but may be what you want.

CMSms related stuff : the FORM is inside a User Defined Tag or a Global Content Bloc to have literal PHP instructions to prefill fields. The actionURL has something similar. This is the hand made way.

Now the industrial way : have you tried the FormBuilder and FormBrowser modules ? or FeedbackForm module ?
If they don't exactly fit your needs, may be you can submit a patch to their authors to get what you want ?

Pierre M.
donnut

Re: How to Preserve Form Field Values When Back Button Pressed

Post by donnut »

Hello Pierre,

Thanks for your reply. Before I used a cms system I used to make a 'FormPage.php' and test and fil the values using php. So that is my reference of thinking. I had a second look at FormBuilder and now I understand how to handle it in the industrial way!  :D

Thanks,
Erwin
Locked

Return to “CMSMS Core”