Setting form fields as required based on dropdown entry
I am trying to set the properties of a few form fields as required in case a specific value is chosen from a drop down list.
I entered the below code to the actions tab of the dropdown properties>Mouse Down>Run a java script. The problem is that it only works if I exit and reenter the dropdown. I tried invoking the code with "Mouse down", "Mouse Enter", Mouse Exit" none of them worked unless I go out and in again to the dropdown list.
Any suggestions?
Thank you!
var devused=this.getField("Device used");
var comptype=this.getField("Type of complaint");
var proname=this.getField("Product name");
var sent=this.getField("Sent to Sponsor");
if (comptype.value=="Product related complaint") {
devused.required=true;
proname.required=true;
sent.required=true;
}
else {
devused.required=false;
proname.required=false;
sent.required=false;
}