Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Values entered in the Form disappears when using the history.go(-1) or history.back()

Reply
Thread Tools

Values entered in the Form disappears when using the history.go(-1) or history.back()

 
 
sujith.bolar@gmail.com
Guest
Posts: n/a
 
      10-16-2006
Hello

I am using a <form method="post"> to submit values to the processing
agent. If the processing agent returns an error, I call the
history.go(-1) or history.back() function to reload the page. The page
does reload but all the values entered disappears.

I am using Java Script and html.
Code:
---------------------
I am filling in the form in "name.html" file.

</head>
<body class="main" onload='startup()'>

<center>
<form method="post" name="example" id="example">
<table>
<tr>
<td>Name:</td>
<td>&nbsp</td>
<td><input type="text" name="name" size="64"
maxlength="64"></td>
</tr>
</table>
</form>
</center>
</body>
</html>


When the processing agent return error, the page is redirected to
"error.html " where the code looks like below:

<script type="text/javascript">
<!--

function submit()
{
history.go(-1); // I tried history.back() too but no luck
}

-->
</script>

</head>
<body class="main">
<br>
<br>
<table>
<tr>
<td>
<center>
<table>
<caption class="cap">Error</caption>
<tr><td> WRONG NAME </td></tr>
</table>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td> &nbsp </td>
<td width="100">
<div id="okButton" class="tbutton"
onmouseup='submit()' Ok </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>


In case an error is thrown, the name.html is loaded as expected but I
lost the values entered in the form.
What should I do to store the values ?

Thanks
I would appreciate any help/repsonse to my question.

- Sujith

 
Reply With Quote
 
 
 
 
Ivan Marsh
Guest
Posts: n/a
 
      10-16-2006
On Mon, 16 Oct 2006 14:13:41 -0700, sujith.bolar wrote:

> I am using a <form method="post"> to submit values to the processing
> agent. If the processing agent returns an error, I call the
> history.go(-1) or history.back() function to reload the page. The page
> does reload but all the values entered disappears.


Of course they do... the page is being re-loaded and none of that data is
part of the page.

Your error processing page must pass and reassign the values to the input
boxes.
 
Reply With Quote
 
 
 
 
nutso fasst
Guest
Posts: n/a
 
      10-17-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> In case an error is thrown, the name.html is loaded as expected but I
> lost the values entered in the form.
> What should I do to store the values ?


Form variables are lost when you redirect. If you must do this, put them in
a cookie.

nf


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to display textbox entered value and with related values intextare using javascr venkat reddy Javascript 1 07-08-2011 04:17 PM
Checking that user has entered a word or words in text input form using regular expressions... Luke Matuszewski Javascript 8 04-22-2006 07:47 AM
Will browser remember values entered in form when i press back button???????? vishal HTML 2 03-28-2005 06:23 PM
How to access values entered in User control in the main page. =?Utf-8?B?dmluZWV0YmF0dGE=?= ASP .Net 2 11-07-2004 12:18 AM
Date entered from textbox becomes null (1/1/1900) when entered into SQL table. TN Bella ASP .Net 1 07-01-2004 02:53 PM



Advertisments