Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: Disabling second submit by hitting browser Refresh button

Reply
Thread Tools

Re: Disabling second submit by hitting browser Refresh button

 
 
Kevin Spencer
Guest
Posts: n/a
 
      08-29-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Ananda Sim
Guest
Posts: n/a
 
      08-29-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
 
Ananda Sim
Guest
Posts: n/a
 
      08-30-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Form submit - hitting enter does not trigger Submit button ASP General 2 10-25-2004 03:37 PM
STRUTS-<html:submit> -Hitting enter key does not submit the form Megha Vishwanath Javascript 3 07-20-2004 05:45 AM
Re: Hitting the "Submit" button multiple times by mistake Joerg Jooss ASP .Net 1 05-22-2004 08:45 PM
force REFRESH after hitting back button Fredo Vincentis HTML 1 11-07-2003 07:21 AM



Advertisments