I am trying to set the default value of one of the form fields as a function of the value on another field. The javascript that I am using is:
if (Forma_pagament == "TRANSFERENCIA"){
return "1361";
}
else{
return "NA";
}
Forma_pagament is the Variable_name of another field in the same form. When previewing the form to test the javvascript I set the data input as:
{
"Forma_pagament": "TRANSFERENCIA"
}
For some reason the Value Forma_pagament does not get the value "TRANSFERENCIA" assigned so always the else statement is executed.
How should I reference other form variables in the javascript code to set the default value of a variable?