Solved

window.history.back(-1) question

Posted on 2001-07-06
4
225 Views
Last Modified: 2012-06-21
I have a text input box in a form which, when the submit button is pressed, calls an ASP page for processing.  When the processing is complete,  I use window.history.back(-1) to go back to the page with the form, is there any  way that I can have the text input box automatically clear its contents when it is displayed again?
0
Comment
Question by:Chris_m
  • 2
4 Comments
 

Expert Comment

by:ianlesoft
ID: 6258723
yes, you can use ASP command "expire" of the page
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6258836
Just replace the streings with the correct names

function document_onload()
{
   document.forms["formname"]["textboxname"].value="";
}

window.onload=document_onload;

Regards,
CJ
0
 

Author Comment

by:Chris_m
ID: 6258912
For ianlesoft:
I am not sure how to ue the expire command
for CJ S:
that would work fine except that the Input box is initially populated with a value obtained from a SELECT box on another ASP page
<INPUT ID="NameAfterChange" NAME="selectedName" VALUE="<%Response.Write(Request.Form("selectedName"))%>">
and if I use your code, the initial value is also cleared.  I only want the box to be cleared when I return to it, not when I initialy go to it.
regards
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
ID: 6258927
function document_onload()
{
  if(document.forms["formname"]["textboxname"].value!="<%=Request.Form("selectedName")%>")
    document.forms["formname"]["textboxname"].value="";
}
window.onload=document_onload;
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tools for analysis of code 4 44
Clear input text 15 26
Rotate images for Web Page 11 24
Can anyone help me find this preloader? 51 35
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question