Is there a way to 'un-disable' a input when a checkbox is checked?

Hey all,

I’m sure this is a simple one but I can’t figure out how to change a input from disabled to useable when a checkbox is checked. It’s easy using the Wappler UI to disable an input when a checkbox is checked, but not the other way around.

Any ideas?

Although the following is code only, the code was produced by following the proper steps in Wappler.

<input id="text1" name="text1" type="text" class="form-control" disabled="true">
<div class="form-check">
    <input class="form-check-input" type="checkbox" id="input1" name="input1" dmx-on:changed="text1.disable((checked != input1.checked))">
    <label class="form-check-label" for="input1">Default checkbox</label>
</div>
1 Like

Thank you Ben. I’m going to try and reproduce this in the UI - much appreciated!

1 Like

You can try to bind the disabled attribute.

<input dmx-bind:disabled="!checkbox1.checked">
3 Likes

Perfect, thanks Sid - I didn’t realise I could do it that simply.