This is a regression in Jakarta and does not happen in Istanbul.
When a client script calls g_form.clearValue on a select Box or Yes/No variable, a change is detected and triggers any onChange client scripts for that field even though the value does not change. In Istanbul, this does not happen.
Investigations carried out so far and any findings:
This does not happen if the Use None option is selected on the select box variable.
Steps to Reproduce
Include pre-requisites when reproducing the issue on a default version demo instance. For example, activating a certain plugin.
- Create a new Catalog item
- Create a variable of type checkbox named field1
- Create a Variable of type Yes/No named field2
- Create an onChange client script for when field1 (the checkbox) changes with this line of code added.
- Create an OnChange client script for when field2 change with this line added.
- g_form.addErrorMessage("Field 2 has changed");
Try the item and notice when the box is checked, the error message is displayed. Therefore, onChange client scripts for the field are being triggered, when doing a g_form.clearValue.
Because the value of the yes/no or select box is not changing, we should not call onChange client scripts.
However, in Jakarta we do call onChange scripts.
As a workaround, use Include None under Type Specification for the variable of type Yes/No or Select Box where this issue is being faced.
Related Problem: PRB1194586