Form input - back button

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a web form that allows the user to enter several pieces of
information.  They can then click to see the results (which takes them to a
report form).  From this form, if the user clicks the Back button on the
browser - they are returned to the input form and all of their inputs are
what they had entered.  However, in the results form I have some links that
when clicked launch new windows (via javascript using

So I have the link:

<a id='link' href="" onclick="return onBrowse(">Link</a>

Here is the onBrowse:

function onBrowse(id)
{"link.asp?id=" + id", "link", "");
    return false;

If the user clicks on these links then closes the new window.  Then the user
clicks the back button from the report form (taking them back to the input
form) - the input form is shown but their selections are lost (they are
returned to their default values).  What exactly is going on and how can I
work around this behavior?

Any help would be most appreciated.


Re: Form input - back button

On Wed, 13 Oct 2004 12:34:07 +0000, Billy Boone wrote:

Quoted text here. Click to load it

Do you *want* them to still have their selections? Or is a cleared form
what you are lookign for?

Either way, this browser behavior can be quite variable depending on what
browser the user is using and how things like cache and history are set
within that browser. You *cannot* depend on the browser for consistent

When I create a form that I want the user's data to not be forgotten when
they submit but there is a mistake or missing required fields or something
like that, I

1) save all the data on the server side in a session
2) send them back to the form using server redirects, but the form is now
filled using the "value=" or "checked" or "selected" properties of the
form fields, based on the saved data.

I use PHP on the server but I'm sure ASP can do the same.

I *never* depend on the browser for consistent behavior.  At least on the
server everything is *mine* and I know how it is configured and what it
will do.

Jeffrey Silverman
** Drop "PANTS" to reply by email

Re: Form input - back button

I want them to still have their selections.

Yeah, I had considered both cookies and session variables.  This is an
intranet application so this will be with IE 6.0 only.

Quoted text here. Click to load it

Re: Form input - back button

Gazing into my crystal ball I observed "Billy Boone"

Quoted text here. Click to load it

No reason it couldn't work cross browser, and you really don't have to use
session variables or cookies (which in the real world are not dependable).  
You can use the information in the request.querystring collection, or you
can have the form post to itself.

I have an example of this with source code at .  

Adrienne Boswell
Please respond to the group so others can share

Re: Form input - back button

As per Jeffrey's suggestion, I'd use frames to get around your problem,
but there was something else I noticed...

Billy Boone wrote:

Quoted text here. Click to load it

This is a particularly nasty way of opening a new window. Try:

    <a href="link.asp?id=" target="mylink"
    onclick="return onBrowse(this.href,">Link</a>


    function onBrowse(u,t)
        return false;

Now your link will work when Javascript is disabled too.

Toby A Inkster BSc (Hons) ARCS
Contact Me  ~

Site Timeline