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

Adobe Forms If/else statement

Explorer ,
May 23, 2023 May 23, 2023

I am a complete novice using Javascript so I would like some help please.

I have a form and would like a field (Day4) to autopopulate with a number from another field or three depending on which field has an entry. For example: if "Day1" has a number in it (i.e. 100) "Day4" should have that same number, however, if "Day1" is blank then "Day4" should be populated with "Day2"'s number, and so on and if all fields are blank then "Day4" is also blank.

 

I have written the following, but I am getting an error "The value entered does not match the format of the field [Day4]"

 

var D1 = this.getField("Day1").value;
var D2 = this.getField("Day2").value;
var D3 = this.getField("Day3").value;

if (D2 == "" && D3 == ""){
event.value = "D1";
}
else if (D1 == "" && D3 == ""){
event.value = "D2";
}
else if (D1 == "" && D2 == ""){
event.value = "D3";
}
else event.value = ""

 

Any assistance would be greatly appreciated.

TOPICS
PDF forms
562
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
1 ACCEPTED SOLUTION
Community Expert ,
May 23, 2023 May 23, 2023

Use

 event.value = D1;

and so on.

 

View solution in original post

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 ,
May 23, 2023 May 23, 2023

Use

 event.value = D1;

and so on.

 

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
Explorer ,
May 23, 2023 May 23, 2023
LATEST

Brilliant thank you it was doing my head in 🙂

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