Update form with dynamic checkboxes

This is driving me nuts! I’ve gone through these forums and all the docs but I just can’t get this to work.

Here’s the scenario.

I have a table containing most of the data. I also have a many-to-many table for the airports. In the update form I have a Checkbox Group which is populated from a query of all the airports in the airports table. My Server Action has the main query and also a query for the airports.

I’ve followed all the docs and thought I had it working but it’s actually only ticking the first airport that’s in the query, not all of them.

Here is a snippet of code to hopefully show where I’m going wrong.

<div class="form-group" is="dmx-checkbox-group" dmx-bind:value="connAccommodation.data.queryAirports[0].AirportID">
								<label for="inp_accomAirports">Airports</label>
								<div class="form-check form-check-inline" dmx-repeat:repeatairports="connAllAirports.data.queryAllAirports">
									<input class="form-check-input" type="checkbox" dmx-bind:id="inp_airport_{{$index}}" name="airport[]" dmx-bind:value="AirportID">
									<label class="form-check-label" dmx-bind:for="inp_airport_{{$index}}" dmx-text="airportName"></label>
								</div>
							</div>

Is someone able to either spot the error or provide a guide for how to do this? The docs seem to not be the same scenario.

Many thanks.

Community Page
Last updated: