If this field is selected, make another field required

If this field is selected, make another field required


Hi,

I'm trying to validate a field based on the value of another field.  I think I've setup the code correctly, but the alert message does not appear on submit.

Basically I'm trying to say - If Return is Yes, than you must enter something in Return_Reason.

Here is my code in Form Action/On Add/Validate -

if (input.Return  ==  "Yes")
{
    if (input.Return_Reason  ==  "")
    {
        alert "Enter a Return Reason";
        cancel submit;
    }
}

Please let me know what I'm doing wrong.

Thanks so much!!