Form input - back button

Discussion in 'HTML' started by Billy Boone, Oct 13, 2004.

  1. Billy Boone

    Billy Boone Guest

    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 window.open).

    So I have the link:

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

    Here is the onBrowse:

    function onBrowse(id)
    {
    window.open("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.

    BBB
     
    Billy Boone, Oct 13, 2004
    #1
    1. Advertising

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

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


    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
    behavior.

    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
     
    Jeffrey Silverman, Oct 13, 2004
    #2
    1. Advertising

  3. Billy Boone

    Billy Boone Guest

    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.

    "Jeffrey Silverman" <> wrote in message
    news:p...
    > On Wed, 13 Oct 2004 12:34:07 +0000, Billy Boone wrote:
    >
    > > 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?

    >
    > 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
    > behavior.
    >
    > 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
    >
    >
     
    Billy Boone, Oct 13, 2004
    #3
  4. Billy Boone

    Toby Inkster Guest

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

    Billy Boone wrote:

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


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

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

    with:

    function onBrowse(u,t)
    {
    window.open(u,t);
    return false;
    }

    Now your link will work when Javascript is disabled too.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Oct 14, 2004
    #4
  5. Billy Boone

    Adrienne Guest

    Gazing into my crystal ball I observed "Billy Boone"
    <> writing in
    news:D3abd.233271$MQ5.25041@attbi_s52:

    > "Jeffrey Silverman" <> wrote in message
    > news:p...
    >> On Wed, 13 Oct 2004 12:34:07 +0000, Billy Boone wrote:
    >>
    >> > 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?

    >>
    >> 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 behavior.
    >>
    >> 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.
    >>

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


    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
    http://www.intraproducts.com/beta/requiredform.asp .


    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.arbpen.com
     
    Adrienne, Oct 18, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sylvia sil
    Replies:
    1
    Views:
    621
    Curt_C [MVP]
    Dec 29, 2004
  2. Guy
    Replies:
    5
    Views:
    2,832
    brucie
    Dec 13, 2003
  3. Author
    Replies:
    6
    Views:
    3,101
    George
    Jan 22, 2009
  4. Billy Boone

    Form input - back button

    Billy Boone, Oct 13, 2004, in forum: Javascript
    Replies:
    4
    Views:
    103
    Adrienne
    Oct 18, 2004
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Replies:
    0
    Views:
    347
    Useful Info
    Jun 3, 2007
Loading...

Share This Page