Originally published on 2018-05-01

Sometimes there is a need for a custom behaviour of radiobutton, such as underline of an option.

function radio() {
    // Show/hide the field border depending on the state of the check box
    var myField = this.getField(event.target.name);
    var ampm = myField.value;

    switch(ampm) {
        case 'AM': 
            var am = getField(myField.name + '.0');
            var pm = getField(myField.name + '.1');
            am.strokeColor = color.black;
            pm.strokeColor = color.transparent;
            break;
        case 'PM' :
            var am = getField(myField.name + '.1');
            var pm = getField(myField.name + '.0');    
            am.strokeColor = color.black;
            pm.strokeColor = color.transparent;          
    }
}