Disable a button when ajax call is being done

Disable a button when ajax call is being done

  


I have done an onchange event which will call a server action. So my question is if I click on submit before I get an response from the server the form is getting submitted. I dont want this to happen. And So I was trying to disable the submit button.

Hi,

I would create a variable of data type Boolean. Set this variable as the Enabled property of the button. Within the server action in the on change event, you can set the variable to True, if all actions have been executed.

Hope this helps.

Sam

Sam Rijkers wrote:

Hi,

I would create a variable of data type Boolean. Set this variable as the Enabled property of the button. Within the server action in the on change event, you can set the variable to True, if all actions have been executed.

Hope this helps.

Sam




Created a local variable as suggested and assigned it to submit button property. Above pic shows assigning value to true after onchange action. Still the Submit button is disabled.

Remember to do an ajax refresh of the item or container after you set the variable for the UI change to take affect.

Solution

This could be 2 things:
1. The variable is not set to true (check the debugger).
2. You did not refresh the button with ajax. Place the button within the container that you are refreshing.

Regards,

Sam

Solution