Need to disable the skuid buttons once clicked

  • 1
  • Question
  • Updated 3 weeks ago
  • Answered
we are using action frame work on the button click where are displaying block UI Message " Please wait" . before the screen comes up we are able to click the button multiple times.is there any solution that we have to disable the button once clicked
Photo of soundar raja

soundar raja

  • 238 Points 100 badge 2x thumb
  • confused

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
1. Give your Button a Unique Id, e.g. "MyButton".
2. Add an Action in your sequence that occurs immediately when you Block UI called "Run Skuid JavaScript Snippet" that runs a JavaScript Snippet, call the snippet something like "DisableMyButton". The content of the Snippet should be this:

skuid.$("#MyButton").button("disable");

3. Later on in the sequence, when the button should be enabled again, add another Run Skuid JavaScript Snippet action to the sequence, that calls a Snippet "EnableMyButton", whose content should be this:

skuid.$("#MyButton").button("enable");
Photo of Korey

Korey

  • 1,108 Points 1k badge 2x thumb
Is there any change to this approach? It'd be nice to do this declaratively instead of through JS.
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 3,280 Points 3k badge 2x thumb
Korey,

There are at least a few declarative ways to do this, most importantly you'll need to use the "Enable Conditions" property under the Rendering tab for the button's properties.

Then you simply need to decide what criteria you want to use to enable that button. Likely using one of the actions in the button's action sequence could serve as the criteria. For example, if your button updates a field on a record, then you could use that field's value as the enabling condition.

You could also create a UI-only checkbox field (set default value to TRUE) and include an action to uncheck that box off within your button's action sequence. Then your enabling condition would be when that checkbox value is equal to true.

In other words, your button is enabled until you click it, the action unchecks the UI-only checkbox, and your button becomes disabled.
Photo of Korey

Korey

  • 1,108 Points 1k badge 2x thumb
Thanks Conlan, I ended up going the UI-checkbox route. It would still be nice to be able to explicitly disable a button rather than adding multiple steps to check if it stays enabled.
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 3,280 Points 3k badge 2x thumb
Yeah, that would be nice.

As a feature request, maybe the Skuid product team would be willing to add an option to 'Enable/Disable Button' under the Run Component Action... :)