Hello friends,
I have two buttons, A and B.
Button B must be disabled until button A receives the Click event.
What is the logic to implement (in Wappler) this Spec?
Thanks.
Add toggle component
Set the second button to disable and the condition is set to toggle unchecked.
Set on click event to check the toggle component in first button
So the toggle will be unchecked at initial stat and when first button clicked it will set the toggle to checked and second button will be enabled.
I hope that will help you.
On the button you can add a dynamic attribute to disable the button when the condition is met it will disable the button:
Thanks @mohif1995 and @Sorry_Duh but, I considered the component property and solved it like this:
For button A --> on click event --> A.disable=‘false’
For button B --> on dynamic attributes --> Value --> disable=‘true’
That way I don’t need to add the toggle component to the page, avoiding unnecessary ‘overload’.
To clarify for others, this is what the code should look like:
<button id="btn1" class="btn btn-success" dmx-on:click="btn2.disable(-1)">Button</button>
<button id="btn2" class="btn btn-secondary" dmx-bind:disabled="1">Button</button>
Thanks @ben for your clarity and didactics. You’re right!
Sorry, didn’t mean to sound patronising. My manner is unfortunately part of being a grumpy old man.
Don’t worry @ben, you are an asset to this community! Have a good Sunday!
I’d been looking for this too - many thanks for posting the code.