How to disable a button and still have the click event to fire.
-
Hello again, I need help trying to get this to work. I want to disable a button when clicked, so that the user doesn’t clicking it again. function Form1_onSubmit() { Form1.btnSaveBudget.disabled=true; } ... However, when the button gets disabled then the click event won’t work. Protected Sub btn_Click(...) Handles btn.Click I need the click event to fire to do something. Thank you </x-turndown>
-
Hello again, I need help trying to get this to work. I want to disable a button when clicked, so that the user doesn’t clicking it again. function Form1_onSubmit() { Form1.btnSaveBudget.disabled=true; } ... However, when the button gets disabled then the click event won’t work. Protected Sub btn_Click(...) Handles btn.Click I need the click event to fire to do something. Thank you </x-turndown>
Hey I am not a JS expert but here are some suggestions: Is the on_submit function not meant to return a value? Does returning true make it work. Does it post back at all? If this doesnt sort it how about instead of disabling it just ignoring it so you would set a bool to true on first press then on further presses check this value and ignore the event. Hope this helps Dan
-
Hello again, I need help trying to get this to work. I want to disable a button when clicked, so that the user doesn’t clicking it again. function Form1_onSubmit() { Form1.btnSaveBudget.disabled=true; } ... However, when the button gets disabled then the click event won’t work. Protected Sub btn_Click(...) Handles btn.Click I need the click event to fire to do something. Thank you </x-turndown>
You are capturing Form OnSubmit event, which happens before the page postback. Form submit must return true. Add a line return true, so that it will postback.
Martin_ wrote:
Form1.btnSaveBudget.disabled=true;
Another suggestion, this type of object identification will not work on all browsers. Start using document.getElementById('<OBJECT_NAME>').
Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group | Blog Spot
-
Hello again, I need help trying to get this to work. I want to disable a button when clicked, so that the user doesn’t clicking it again. function Form1_onSubmit() { Form1.btnSaveBudget.disabled=true; } ... However, when the button gets disabled then the click event won’t work. Protected Sub btn_Click(...) Handles btn.Click I need the click event to fire to do something. Thank you </x-turndown>
Have a javascript registered through page.registerstartupscript and enable the button through that