How can I determine multiple possible default values of a field taking into account the values of two other fields in a form? For example, set the value of the field "Eval" to "Good" taking into account that another field "color" is "green" and a second field "Temperature" is "Hot", set the value of the field "Eval" to "Satisfactory" when field "color" is "orange" and "Temperature" is "Medium" and set the value of the field "Eval" to "Bad" when field "color" is "red" and "Temperature" is "Cold". I tried to solve the problem like this : {% Form.OnBeforeValidate += BeforeValidateHandler;%} {% if(color=="Green" && temperature=="Hot"){Form.Data.SetValue("Eval", "Good")};#%} {% if(color=="Orange" && temperature=="Medium"){Form.Data.SetValue("Eval", "Satisfactory")} else {Form.Data.SetValue("Eval", "Bad")};#%} Thank you for your help.
Your best bet for this is some javascript to auto-select/enter the value(s) you want. Using a macro will not work because the macro processing happens too early/late in the form processing.
But if you want only set values on submission then simply use the OnAfterSave event of the online form by either creating a custom webpart OR creating a global event handler for the form submission.
Thank you, Brenden. I'll do it this way.
Please, sign in to be able to submit a new answer.