Form input - back button

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Billy Boone

    #1

    Form input - back button

    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.i d)">Link</a>

    Here is the onBrowse:

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


  • Jeffrey Silverman

    #2
    Re: Form input - back button

    On Wed, 13 Oct 2004 12:34:07 +0000, Billy Boone wrote:
    [color=blue]
    > 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?[/color]

    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
    jeffreyPANTS@jh u.edu
    ** Drop "PANTS" to reply by email


    Comment

    • Billy Boone

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

      "Jeffrey Silverman" <jeffreyPANTS@j hu.edu> wrote in message
      news:pan.2004.1 0.13.12.45.56.1 1258@jhu.edu...[color=blue]
      > On Wed, 13 Oct 2004 12:34:07 +0000, Billy Boone wrote:
      >[color=green]
      > > If the user clicks on these links then closes the new window. Then the[/color][/color]
      user[color=blue][color=green]
      > > clicks the back button from the report form (taking them back to the[/color][/color]
      input[color=blue][color=green]
      > > 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[/color][/color]
      I[color=blue][color=green]
      > > work around this behavior?[/color]
      >
      > 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
      > jeffreyPANTS@jh u.edu
      > ** Drop "PANTS" to reply by email
      >
      >[/color]


      Comment

      • Toby Inkster

        #4
        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:
        [color=blue]
        > <a id='link' href="" onclick="return onBrowse(this.i d)">Link</a>[/color]

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

        <a href="link.asp? id=" target="mylink"
        onclick="return onBrowse(this.h ref,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

        Comment

        • Adrienne

          #5
          Re: Form input - back button

          Gazing into my crystal ball I observed "Billy Boone"
          <b3booner@insig htbb.com> writing in
          news:D3abd.2332 71$MQ5.25041@at tbi_s52:
          [color=blue]
          > "Jeffrey Silverman" <jeffreyPANTS@j hu.edu> wrote in message
          > news:pan.2004.1 0.13.12.45.56.1 1258@jhu.edu...[color=green]
          >> On Wed, 13 Oct 2004 12:34:07 +0000, Billy Boone wrote:
          >>[color=darkred]
          >> > 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?[/color]
          >>
          >> 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.
          >>[/color]
          > 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.
          >[/color]

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

          Comment

          Working...