I am updating optionset value inside onchange function to the previous selection after showing an alert. which works fine but the function is again trigered due to this update. How can I prevent this.
Below id my code:
//registered on change of new_decision field
function onchange(){
var formContext = eContext.getFormContext();
alert("This is not a valid decision for application");
formContext.getAttribute("new_decision").setValue();
}
I have tried few things like atttaching onchange through addonchange method insted of Form UI.
I have also turned on legacy form rendering but it is firing in a loop.