0

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?

osantos
  • 352
  • 2
  • 18
  • I tried retrieving the value of the variable in the javascript code with: getField("Forma_pagament").value but did not seem to work for me either. – osantos Sep 23 '22 at 10:49

0 Answers0