I can use this code in events / add page / JavaScript OnLoad event to hide a field, and only show it if the answer of the other field is "yes".
pageObj.hideField("describe");
var ctrlOne = Runner.getControl(pageid, 'injured');
ctrlOne.on('change', function(e) {
if (this.getValue() == "yes"){
pageObj.showField("describe");
} else {
pageObj.hideField("describe");
}
});
I've now changed the first field to a checkbox instead of a "yes" or "no" dropdown. I can't seem to get the conditional code to work anymore. I thought it should look something like this:
pageObj.hideField("describe");
var ctrlOne = Runner.getControl(pageid, 'injured');
ctrlOne.on('change', function(e) {
if (this.getValue() == 1){
pageObj.showField("describe");
} else {
pageObj.hideField("describe");
}
});
but that doesn't work. I've tried it a bunch of other ways and still haven't gotten it correct. Any ideas on what I'm doing wrong?
Thanks!