function toggleCheckbox() { chbxItem = IWDatacapture.getItem("/page/your/item"); var areaOptions = chbxItem.getOptions(); var chekVal = chbxItem.getValue(); if (chekVal != '') { areaOptions[0].selected = false; } else { areaOptions[0].selected = true; } chbxItem.setOptions(areaOptions); }
var areaOptions = Item.getOptions();areaOptions[0].selected = false;Item.setOptions(areaOptions);-------------or to toggle on/off------------- function toggleCheckbox() { chbxItem = IWDatacapture.getItem("/page/your/item"); var areaOptions = chbxItem.getOptions(); var chekVal = chbxItem.getValue(); if (chekVal != '') { areaOptions[0].selected = false; } else { areaOptions[0].selected = true; } chbxItem.setOptions(areaOptions); } -------------I was in a hurry to get this working. Does anyone have any good ideas on how to make this more compact? This code works, it just seems a little clunky to me...
function toggleCheckbox(chbxItem) { var options = chbxItem.getOptions(); var chekVal = chbxItem.getValue(); options[0].selected = !options[0].selected; chbxItem.setOptions(options);}
function toggleCheckbox(chbxItem) { var options = chbxItem.getOptions();var chekVal = chbxItem.getValue(); options[0].selected = !options[0].selected; chbxItem.setOptions(options);}
function toggleCheckbox(chbxItem) { var options = chbxItem.getOptions(); var chekVal = chbxItem.getValue(); options[checkVal].selected = !options[checkVal].selected; chbxItem.setOptions(options);}