mardi 26 janvier 2021

Freemarker how to select only true checkboxes?

Have following data passed from backend:

ALL_CONFIGS: {callDigitalIo=true, controllerId=1, numberPlatesHashSalt=..., numberPlatesShouldBeHashed=false, parkingStatusShouldBeChecked=true}

Where boolean params should be displayed like input element with type=checkbox.

Here is how I handle it on UI page (.ftl):

<div>
    <label class="col-form-label">
        Parking Status Should Be Checked:
        <input type="checkbox" class="form-check-input ml-2"
               id="parkingStatusShouldBeChecked" name="parkingStatusShouldBeChecked"
               <#if parkingStatusShouldBeChecked??>checked="checked"</#if>
        />
    </label>
</div>

However, checkboxes are all selected:

enter image description here

Number Plates Should be Hashed should not be selected.

How to select only true variables?




Aucun commentaire:

Enregistrer un commentaire