Unable to uncheck checkbox

Hi,

Not sure what I am doing wrong. I have a single checkbox, and when checked it goes to a particular URL and when you uncheck it then it’s suppose to go to another URL (just a different parameter value).
Checking the checkbox works fine and it goes to the set URL, but once I check the checkbox I am unable to uncheck it.

<form id="form_clean_toggle">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="input_toggle_cl" name="input_toggle_cl" dmx-on:changed="browser1.goto('search_results_test5.php?'+form_clean_toggle.input_toggle_cl.value)" value="cl=1" dmx-bind:checked="(query.cl == 1)">

<label class="form-check-label small text-success" for="input_toggle_cl">Clean <i class="fab fa-bootstrap"></i></label>
</div>
</form>

In the on changed event, place a ternary operator like checked ? goto1 : goto2.

2 Likes

Hi @ben. Thanks for the reply. I don’t quite follow how/where I can do this.
In ‘Dynamic Event’ on the Checkbox ‘value changed’ I am choosing Browser go to… but not sure after that?

Thanks @ben. I’v solved it using your suggestion!

<div class="form-check">
  <input class="form-check-input" type="checkbox" id="input_toggle_av" name="input_toggle_av" value="av=1" dmx-bind:checked="(query.av == 1)" dmx-on:changed="checked ? browser1.goto('search_results.php?av=1') : browser1.goto('search_results.php')">
  <label class="form-check-label small text-success" for="input_toggle_av">Admin View</label>
</div>
2 Likes