How To Stop Students From Clicking Twice

J

Jim Bayers

We need to stop students from clicking on the form button more than once.

We have a form that students fill out with their credit card information.
They click, the form sends the data in xml to Bank of America, theres a
short wait, BofA sends back some xml, and on to the next page.

Sometimes, though, BofA is slow and the students get impatient, clicking
twice or even more. They get charged each time they click.

We have a warning that says, 'Click only once' but students don't heed it.

Any ideas?
 
H

Hermit Dave

you can disable the button on click. either you can choose to write the code
for that or you download the same (if someone is kind enough to do it for
you)
have a look at
http://aspzone.com/archive/2004/01/06/292.aspx

i have used it in past and it works great. Check the demo. if you like what
you see.. download the project compile it and use the oneclickbutton instead
of normal button

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
D

darrel

We have a warning that says, 'Click only once' but students don't heed it.

On the first click, immediately direct them to a new page while you wait for
the data to return.

Even then, you're going to get some folks that instinctively double-click.
The best bet is to write code to check for that. Log the first click and
then on each click, check to see that there isn't one already submitted in
the last X seconds with the same data. If so, ignore it.

-Darrel
 
K

Kevin Spencer

Good rule of thumb: NEVER count on your users to do what they are supposed
to do. Students, teachers, and Joe SixPack alike, humans are unreliable and
unpredictable. Anything in your app that is necessary to be done should be
done BY your app.

IOW, you can't stop it. Therefore, you handle it. You write code into your
app that handles the event of a user clicking a button twice. Some solutions
include:

1. After clicking once, disable or hide the button. This can be done
server-side or client-side. Best to do it on the server, so as to survive
postbacks.
2. Use a server-side persistent value (ViewState or SessionState) that is
set the first time the user clicks the button. Check that value to see
whether the button has already been clicked prior to executing the business
logic that you don't want repeated.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
L

Lucas Tam

We have a form that students fill out with their credit card
information. They click, the form sends the data in xml to Bank of
America, theres a short wait, BofA sends back some xml, and on to the
next page.

Can you do an asyncronous process?

Submit the form and redirect the students to a thank you page.

In the background process the CC transaction. If there is a failure, e-mail
the student?

This way you can reduce double clicks drastically.

Someone else mentioned disabling the submit button. This works as well but
doesn't prevent double clicks (i.e. If the student has javascript
disabled).
 
G

Guest

1. After clicking once, disable or hide the button. This can be done
server-side or client-side. Best to do it on the server, so as to survive
postbacks.

Its interesting for me, how are you going to do this server side?

When the user clicks on button, a post request is initiated by
the browser. Until the response from server arrived you have OLD PAGE
IN YOUR BROWSER WITH ENABLED BUTTON - you can press the button again.

Such issues must be done ONLY client side. Write a javascript function
which will set IFRAME over all other objects with message "Please wait"
inside, and make so that it is invoked when the button clicked.
 
K

Kevin Spencer

You made a good point. I will change my recommendation to "both client and
server-side" - client-side for immediacy, and server-side for surviving
PostBacks.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
K

Kevin Spencer

That is a nice Control!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
M

Mike Newton

Ihor said:
Its interesting for me, how are you going to do this server side?

When the user clicks on button, a post request is initiated by
the browser. Until the response from server arrived you have OLD PAGE
IN YOUR BROWSER WITH ENABLED BUTTON - you can press the button again.

Such issues must be done ONLY client side. Write a javascript function
which will set IFRAME over all other objects with message "Please wait"
inside, and make so that it is invoked when the button clicked.

There is a way to do it. When the page posts back the first time,
disable the button. Then, register a client side script to immediately
post back again (theForm.submit()).

If the controls are written with viewstate in mind, they should retain
all of the data that the user entered.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top