473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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><tdWRONG 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

Oct 16 '06 #1
2 2312
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.
Oct 16 '06 #2

<su**********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro 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
Oct 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jose Antonio | last post by:
Hi, I am writing an app which reads a SQL Server schema, configures a dataset with that information and finally writes the xsd schema to a file. The problem is that the resulting xsd file...
2
by: vineetbatta | last post by:
Hi all, i have a user control which allows the user to enter Name& Address in text boxes. I use the same user control in the main page... Is there a simple way of accessing the Name &...
1
by: Deepali | last post by:
I have created one page,which have 3 textboxs, user will fill the textboxes. After filling last textbox javascrpt function is called, which calls the same page again and do other work. Now the...
8
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated?...
11
by: joey.powell | last post by:
Hello, I have a windows forms application (VS2005) where I need to do the following... 1. Startup with a main form. 2. Have the user to select a file and then bring up a second form modally...
1
by: =?Utf-8?B?SlA=?= | last post by:
Using C# and JavaScript Framework 2.0 My users want to be able to start a search by clicking the enter key. Since the page uses View control, I placed an onkeypress event on the table for each...
1
by: sandeep daksh | last post by:
Hi friends can anyone help me out from this situation. The problem has come when i submit a form and click on the resulting image for the detail page and then click back button i got this problem...
0
by: marcopolo8 | last post by:
Wierd thing is happening during my xHTML development. When I set the width attribute of a text field in a form and use percentages, if the text field's value is extremely long, IE6 automatically...
10
by: vladimirblotan | last post by:
Hi, I'm trying to create a dynamic form that is accessed from multiple pages. I've created the form and included into one of the main PHP pages using the include() function. Now, when I run...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.