AC2 Bug #11 - dmx:updated of Checkbox not Firing when Checkbox updated by Clicking Something Else

Wappler Version : 5.8.2 Beta dmxAppConnect (2023-06-23 0942)
Operating System : Windows
Server Model: PHP
Database Type: MySQL
Hosting Type: WAMP

Expected behavior

What do you think should happen?

With the code below, clicking on the <p>Early Bird Price - £500</p> paragraph should set or unset the checkbox, which should then trigger an update to the array these_templates

<div class="row pt-1 mb-0 mx-0 rc_10 bg_right0">

										<div class="col col_icon_left ml-1">
											<!-- <i class="material-icons md-24">local_activity</i> -->
											<p class="icon_symbol_left bg_icon_price pt_4 mb-0"><i class="fas fa-ticket-alt"></i></p>
										</div>
										<div class="col pl-0">
											<!-- Price title and amount -->
											<p class="m-0 pt_4 pb-1 px-1 rc_5 fs_90 c_right8 bgh_right1 cursor_pointer font-weight-bold" dmx-on:click="
								i_add_price_template.checked?i_add_price_template.select(false):i_add_price_template.select(true)" dmx-class:is_deleted="is_deleted==1" dmx-class:is_hidden="(out_of_date.value==1)||(sold_out==1)||(is_hidden==1)">
												<span dmx-text="title_external+' - '+this_activity_currency_symbol.value+price_amount">Early Bird Price - £500</span><span dmx-show="is_deleted==1" dmx-text="' (Deleted)'"></span></p>



											<p class="d-none c_green1 font-italic">Start Date: {{availability_start_date}}, End Date: {{availability_end_date}}, Today: {{today_start.datetime}}</p>
										</div>
										<div class="col col_view_left_narrow">

											<input id="i_add_price_template" name="add_template" class="input_checkbox" type="checkbox" dmx-on:updated="checked?these_templates.addUniq(id):these_templates.remove(id)" value="1"
												dmx-bind:checked="these_templates.items.contains(id)?true:false">
										</div>
									</div>

Actual behavior

What actually happens?

In the stable channel it does, but in the beta channel, the checkbox changes condition but these_templates doesn’t get updated.

How to reproduce

To see in the live 3.9.7 app, login to Workshop Angel and go to:

  • Activities
  • Example Retreat
    1. Questions
  • Add From Template
  • Click on text of any of the questions listed (Refund Policy etc)
  • Check the value of these_templates… if it has a count of > 0 then the Add Questions button appears, but it doesn’t in the beta channel.

Hang on, I’ve not described this correctly… will be back in a moment!

Okay, I’ve updated it now, the issue wasn’t the setting of the checkbox, it was the subsequent update of the array these_templates

Here an update: dmxAppConnect.zip (28.2 KB)

The expression you use on click can be simplified to

i_add_price_template.select(!i_add_price_template.checked)

Why don’t you use a label with the for attribute, when clicked on a label it will also toggle the checkbox. This is default browser behavior and also for accessibility better.

<label for="mycheckbox">Click here to toggle the checkbox</label>
<input type="checkbox" id="mycheckbox">

Fixed… thanks Patrick! :star_struck:

And thanks for the ideas!

fixed in the extensions beta channel as inline update