Hello,
I've been working on a JavaScript webresource which shows/hides sections based on checkbox being checked/unchecked. The checkbox appears to be working fine on the first click, but afterwards, however, it just keeps returning "yes" alerts no matter if checked or unchecked.
function onchange(context) {
var formContext = context.getFormContext();
var value = formContext.getAttribute('my_field').getValue();
var tabsect= formContext.ui.tabs.get("my_tab");
if (value = 1)
{
tabsect.sections.get('tab_9_section_2').setVisible(true);
alert ("yes");
}
else {
tabsect.sections.get('tab_9_section_2').setVisible(false);
alert ("no");
}
formContext.data.refresh(true);
}
Above is a snippet of my code. Whatever I do with the code, it either returns an error or just keeps returning "yes" alerts as it is stuck. Any suggestions?