CodeIgniter Forums
On page refresh clear form values - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: On page refresh clear form values (/showthread.php?tid=61185)



On page refresh clear form values - El Forum - 10-09-2014

[eluser]Unknown[/eluser]
Input fields of my form don't change on page refresh if I type something in them and then refresh the page. They only change if I manualy click the URL bar or restart the browser. This is becoming a nuisance as I need to populate form with new values on each refresh. And values change on ajax request. Not on form submit.

In short, how do I prevent Codeigniter from remembering values and instead display values from database on each page refresh.

Code:
<input name="uatitle" value="<?php echo $value->acontentdetail->title; ?>">

On refresh I would like to display data from my controller not the data I just typed in.


On page refresh clear form values - El Forum - 10-09-2014

[eluser]larsonator[/eluser]
Try echoing $value->acontentdetail->title stright out onto the page and see if the value is changing?

This sounds more like a caching issue than codeigniter.
You can add meta tags to tell the browser to not cache the page,

You other option would be to use jquery and use the onload event to clear the input. (this would be done when the page had finished loading, and $value->acontentdetail->title would also be cleared.



On page refresh clear form values - El Forum - 10-09-2014

[eluser]Unknown[/eluser]
Solved the problem by adding autocomplete="off" in input field. Seems like only Firefox saves form data on page refresh.