Welcome Guest, Not a member yet? Register   Sign In
after form submit and use back button..form have values...need to remove
#1

[eluser]dine[/eluser]
Hi

I need very urgent help from ur side

When i do search with some data. it redirect me to result-data page. but when I use browser back button on result page.... I get search form with same values prefilled


i am sorry for my english. but only what all i want to remove those fields values when I back to that page

thanks a lot
#2

[eluser]Dam1an[/eluser]
This is expected behavious, why do you NEED to clear the values when you go back?
If you reloa that page (force refresh) it clears the values just like it should
#3

[eluser]TheFuzzy0ne[/eluser]
If you want the results to be cleared, just redirect back to that page again once the form has been submitted successfully. Using the back button will pull up the cached results, which you have little/no control over.
#4

[eluser]Dam1an[/eluser]
Actually, you could send a no cache header... someone had a similar problem a few days back and that solved it
#5

[eluser]Vi.[/eluser]
As I remember, I used like this solution. Add this code to submit button's action. Data will be post before all input reset.

Code:
onsubmit="document.form_name.reset();"
#6

[eluser]dine[/eluser]
[quote author="inSerenity" date="1243096766"]As I remember, I used like this solution. Add this code to submit button's action. Data will be post before all input reset.

Code:
onsubmit="document.form_name.reset();"
[/quote]

Don't know why but it's not working. I means I lost all data
#7

[eluser]Dam1an[/eluser]
Would reseting the form on submit not clear all the data before its sent in the POST array?
#8

[eluser]dine[/eluser]
[quote author="Dam1an" date="1243102223"]Would reseting the form on submit not clear all the data before its sent in the POST array?[/quote]
Thanks for reply
What all I am doing and getting is :

If I set this "Onsubmit" event on submit button... it remains data in cache..I means data display in form when use back button

If I set this event on form it reset the values but there is also on values in POST.. I know it is Obvious and I am doing wrong
#9

[eluser]Dam1an[/eluser]
Have you tried sending the no cache header, as explained in this post
#10

[eluser]Vi.[/eluser]
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
  &lt;title&gt;&lt;/title>
  [removed]
  /* Clear function will clear the value Add your Input name below */
  function clear(){
    parent.document.forms[0].Keyword.value = ""; /* Reset keyword input name */
    parent.document.forms[0].Where.value = "";   /* Reset Where input name */
  }
  [removed]
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    print_r($_POST); // Print posted data
?&gt;
&lt;form name="form" method="POST" enctype="application/x-www-form-urlencoded" action=""&gt;
    &lt;input name="Keyword" value="asddd" /&gt;
    &lt;input name="Where" value="" /&gt;
    &lt;input  type="submit" name="submit" value="Send" /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Here is my code. I tried this code and It is working only with IE. Modern browsers use cache for fast Go back. You can check this page to no-cache header. This is easy way to do.




Theme © iAndrew 2016 - Forum software by © MyBB