views:

29

answers:

2

sir,

problem analysis:

when i m clicking a submit button of my html form the function related to the button is called and it does its work.after completing the work a mail notification is sent which is consuming too much time.after that a confirmation message is displayed on the same html (without using ajax i,e page is refreshed).

my question and need:

i want to avoid the user by clicking the submit button a number of times in confusion during the waiting period of sending mails.so i m thinking to disable the button after it is pressed once.

1) How to do it?

2)can you please suggest any other technique to achive this goal without disabling the button?

+3  A: 

I belive that this will work:

onclick="this.disabled=true"
rodrigoap
`onclick="this.disabled=true; this.value='please wait...';"`
pstanton
A: 

You could also simply hide the button, again using javascript in the onclick event, but this time add a style, such as "display:none", and then the button will not be displayed for the user to click on at all.

Note: This may be disturbing to some users. Developer discretion is advised.

cdeszaq