Re: Disabling second submit by hitting browser Refresh button

Discussion in 'ASP .Net' started by Kevin Spencer, Aug 29, 2003.

  1. You can't prevent it, but you CAN handle it.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Big Things are made up of
    Lots of Little Things.

    "Ananda Sim" <> wrote in message
    news:...
    > Hi All,
    >
    > I made a multi-use webform that allows data entry and then on successful
    > submission, the data entry controls and the submit button is set to
    > visible=false
    >
    > That works.
    >
    > However, if I hit the browser's Page Refresh the form submits again. Is

    this
    > some browser cached copy of the previous contents or the actual non

    visible
    > contents submitting?
    >
    > What approach do I use to prevent this happening?
    >
    > Thanks
    > Ananda
    >
    >
     
    Kevin Spencer, Aug 29, 2003
    #1
    1. Advertising

  2. Kevin Spencer

    Ananda Sim Guest

    Hi Kevin,

    Oh, alright, I'll bite. How do I Handle it? Check the click event of the
    button and then do what? look for an existing entry in the database and
    redirect? Is there a better way that does not require further db access?

    Thanks
    Ananda

    "Kevin Spencer" <> wrote in message
    news:...
    > You can't prevent it, but you CAN handle it.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > http://www.takempis.com
    > Big Things are made up of
    > Lots of Little Things.
    >
    > "Ananda Sim" <> wrote in message
    > news:...
    > > Hi All,
    > >
    > > I made a multi-use webform that allows data entry and then on successful
    > > submission, the data entry controls and the submit button is set to
    > > visible=false
    > >
    > > That works.
    > >
    > > However, if I hit the browser's Page Refresh the form submits again. Is

    > this
    > > some browser cached copy of the previous contents or the actual non

    > visible
    > > contents submitting?
    > >
    > > What approach do I use to prevent this happening?
    > >
    > > Thanks
    > > Ananda
    > >
    > >

    >
    >
     
    Ananda Sim, Aug 30, 2003
    #2
    1. Advertising

  3. Kevin Spencer

    Ananda Sim Guest

    Hi Jerry,

    Thanks for that. My webform is indeed submitting to a database. I don't want
    to create another success page because it is expected by the sponsor that
    the success page is essentially the submit page with (for want of a better
    description) locked controls. And the sponsor has had a track record of
    wanting to edit the text content of the page(s) thus causing irritating
    errors as both pages have to be kept up to date (was a pain in asp, less so
    in asp.net).

    So my current design proposal is that the submit page is the success page.

    I was toying with the idea of using session variable(s) as identifiers/flags
    or database search for duplicate entry. I'm going the database way as the
    amount of traffic is not expected to be heavy - I suppose session variables
    are less scalable but that does not concern me at this stage.

    You bring up multi-page forms. An excellent segue to making survey forms --

    What is the optimum approach for reliable survey forms?

    One simple way is to store the values as session variables - that means
    regardless of how many webpages you make up, we have a mechanism to iterate
    and handle them.

    However, my one attempt to do that was not very reliable.
    a. the session variables somehow got lost possibly with the forward / back
    or the postbacks caused by validation controls.
    b. of course if the session was dropped somehow, the web visitor had no
    saved record.

    So... does this mean that
    a. one captures the visitor id and stores it in db on the initial greeting
    page?
    b. that one keeps going to the record(s) in the db for saves as well as
    forward/back navigation?

    thanks

    Ananda




    "Jerry III" <> wrote in message
    news:...
    > Your application should not care how many times the form is submitted
    > (unless of course the submission results in updating a database for

    example,
    > in which case you should redirect the user to a "success" page if the

    update
    > succeeds instead of just sending a response page). You should handle it in
    > the same way as the user going back and forth your multiple page form (the
    > user can do it many times).
    >
    > Jerry
    >
    > "Ananda Sim" <> wrote in message
    > news:%...
    > > Hi Kevin,
    > >
    > > Oh, alright, I'll bite. How do I Handle it? Check the click event of the
    > > button and then do what? look for an existing entry in the database and
    > > redirect? Is there a better way that does not require further db access?
    > >
    > > Thanks
    > > Ananda
    > >
    > > "Kevin Spencer" <> wrote in message
    > > news:...
    > > > You can't prevent it, but you CAN handle it.
    > > >
    > > > --
    > > > HTH,
    > > >
    > > > Kevin Spencer
    > > > Microsoft MVP
    > > > .Net Developer
    > > > http://www.takempis.com
    > > > Big Things are made up of
    > > > Lots of Little Things.
    > > >
    > > > "Ananda Sim" <> wrote in message
    > > > news:...
    > > > > Hi All,
    > > > >
    > > > > I made a multi-use webform that allows data entry and then on

    > successful
    > > > > submission, the data entry controls and the submit button is set to
    > > > > visible=false
    > > > >
    > > > > That works.
    > > > >
    > > > > However, if I hit the browser's Page Refresh the form submits again.

    > Is
    > > > this
    > > > > some browser cached copy of the previous contents or the actual non
    > > > visible
    > > > > contents submitting?
    > > > >
    > > > > What approach do I use to prevent this happening?
    > > > >
    > > > > Thanks
    > > > > Ananda
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Ananda Sim, Aug 30, 2003
    #3
    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. Joerg Jooss
    Replies:
    1
    Views:
    417
    DotNetJunkies User
    May 22, 2004
  2. Mark
    Replies:
    1
    Views:
    1,738
  3. Fredo Vincentis

    force REFRESH after hitting back button

    Fredo Vincentis, Nov 7, 2003, in forum: HTML
    Replies:
    1
    Views:
    4,220
    Toby A Inkster
    Nov 7, 2003
  4. Guest
    Replies:
    2
    Views:
    1,630
    Guest
    Oct 25, 2004
  5. Megha Vishwanath
    Replies:
    3
    Views:
    748
    Megha Vishwanath
    Jul 20, 2004
Loading...

Share This Page