Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Validation Script When Drop Down value = something set another field to be required

New Here ,
Dec 19, 2019 Dec 19, 2019

I have a drop-down filed titled Initial Contact Type and another titled UCR Offense1

 

If the value selected in the initial contact type field is Response to unlawful or suspicious activity I want the UCR Offense1 field to be required else leave it not required

 

I put the following code in the Run custom validation script section of the UCR Offense1 field.

It does not work it will change the UCR Offense1 field to required no mater what is in the field.

 

Any Thoughts

 

var v = this.getField("Initial Contact Type").value;

if(v = "Response to Unlawful or Suspicious Activity"){
event.target.required = true;
}
else {
event.target.required = false;
}

 

TOPICS
PDF forms
250
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2019 Dec 19, 2019
LATEST

Hi,

You must write:

if(v == "Response to Unlawful or Suspicious Activity")

and place the script in "calcul" of the field if you wish keep "event.target.required".

Else you place the script in mouse up of the drop-down field, but you will have to use "this.getField("UCR Offense1").required"= true/false. You need to tick "Commit on selection change" (I don't know the exact name in English).

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines