It works in my head but not in the real world... The checkbox codes works if I just show and hide elements i.e. if I connect the two fields via the database green icon to two separate text fields but I want to get it changing by drawing from the database to ease the setItem if used.
Many thanks in advance!
function privateCheckbox () {
let Price = $w("#dynamicDataset").getCurrentItem();
for (let i = 1; i < 3; i++) {
$w(`#checkbox${i}`).onChange(() => {
const checkBoxes = ['checkbox3', 'checkbox4'];
let filtered = checkBoxes.filter(item => item !== `checkbox${i}`);
filtered.forEach((checkbox) => {
$w(`#${checkbox}`).checked = false;
});
if ($w('#checkbox1').checked) {
$w('#pricePrivate1to1').text = Price.price11.toString();
}
if ($w('#checkbox2').checked) {
$w('#pricePrivate1to1').text = Price.privatePrice12.toString();
}
});
}
}
Got it! thank you for your help!
Here is the code if it helps anyone else.
export function radioGroup1_change(event) { let Price = $w("#dynamicDataset").getCurrentItem(); if ($w("#radioGroup1").value === "1") { $w('#pricePrivate1to1').text = Price.price11.toString(); } if ($w("#radioGroup1").value === "2") { $w('#pricePrivate1to1').text = Price.privatePrice12.toString(); } }