I have a Radio Button Group with two choices, when a click event for example, I want to check for each option, if “ON” is selected call treatment 1, else if “OFF” is selected call another treamtment 2.
Radio-Button Group ID : htmlSelectOneRadio
Individual option 1 ID : optOn
Individual option 2 ID : optOff
The value and Item value for the 2 Individual options are empty.
something like this :
var radioGroupModel = CAF.model("#{caf:cid('htmlSelectOneRadio')}");
var itemOn = radioGroupModel.get('optOn');
var itemOff = radioGroupModel.get('optOff');
if (itemOn.selected() == true) {
treatment1();
}
if (itemOff.selected() == true) {
treatment2();
}
I’m not sure what code would return null there (there’s no return statement) but you’re calling a nonexistent method to see whether or not the item is checked.