Go Back   Cloud Computing > Support > PHP Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-11, 02:34
BOD Member
 
Join Date: Aug 2011
Posts: 76
Default form button cannot be clicked twice

when the user clicks on a form button to get to next page then an email will be sent to the administrator. but then the user might have clicked twice thus causing multiple emails to send to the administrator . is there any way to ensure that the user only clicks once?

i thought of this: whenever the user click once, the button would be disabled to prevent the user from clicking it twice. can use javascript is it? is there a way to do it using php because my application is in php codes.
Reply With Quote
  #2 (permalink)  
Old 09-21-11, 18:13
BOD Member
 
Join Date: Jul 2011
Posts: 68
Default

If you are using regular HTML form, once the submit button clicked it should load the web page set in the action attribute of the form tag. I very surprised how you are getting the problem.

If you want to disable it though once it is been clicked, you will have to do it client side with JavaScript. PHP is server side, so you will not be able to do it that way.

However, keep in mind that users might disable JavaScript on their web browser, in that case the button will not get disabled.
Reply With Quote
  #3 (permalink)  
Old 09-21-11, 18:25
BOD Member
 
Join Date: Jul 2011
Posts: 59
Default

For an instance. If your submit button name is submitbutton
event used is onsubmit()'
formname.submitbutton.disabled=true;

The onsubmit is an attribute you include to the form tag. So, something like this ...

Quote:
<form name="name" action="action" onsubmit="javascript:your_function_name()">
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 01:18.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.