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

Javascript Nested If punctuation

New Here ,
Mar 25, 2023 Mar 25, 2023

I have 3 textboxes(tb) ("MandatoryTotalLodge01", "L1Lodge01MajorTotal" and "L1Lodge01BasicTotal")with calculated sums.If a condition in each field meets its criteria, a fourth textbox(target"CSComplete01") shows 1 message("Cornerstone Complete"), if ALL do not meet, it shows another ("Still Working"). The following is what I have in the the custom calculation of the target tb. I strongly feel its puncuation.

Any helpers?

 

if (this.getField(“MandatoryTotalLodge01”).value>= 1) && if(this.getField(“L1Lodge01MajorTotal”)>= 1)&& if(this.getField(“L1Lodge01BasicTotal”).value>= 1 );
{
event.value=this.getField("CSComplete01").value = "Cornerstone Complete";
}

TOPICS
General troubleshooting , How to , PDF forms
734
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 ,
Mar 25, 2023 Mar 25, 2023

You got that error because you didn't use correct quotes.

MandatoryTotalLodge01

"Cornerstone Complete"

The green ones are correct, but you also have other errors in your script.

Try to use this as custom calculation script of "CSComplete01" field:

var f1 = Number(this.getField("MandatoryTotalLodge01").valueAsString);
var f2 = Number(this.getField("L1Lodge01MajorTotal").valueAsString);
var f3 = Number(this.getField("L1Lodge01BasicTotal").valueAsString);

if(f1&&f2&&f3){
 if(f1>=1 && f2>=1 && f3>=1)
 event.value = "Cornerstone Complete";
 else
 event.value = "Still Working";}
else
event.value = "";

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
New Here ,
Mar 25, 2023 Mar 25, 2023

I inserted a ".value" after my "if(this.getField(“L1Lodge01MajorTotal”)>= 1)" 

The error reads:

"Syntax Error: illegal character

1: at line 2

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 ,
Mar 25, 2023 Mar 25, 2023

You got that error because you didn't use correct quotes.

MandatoryTotalLodge01

"Cornerstone Complete"

The green ones are correct, but you also have other errors in your script.

Try to use this as custom calculation script of "CSComplete01" field:

var f1 = Number(this.getField("MandatoryTotalLodge01").valueAsString);
var f2 = Number(this.getField("L1Lodge01MajorTotal").valueAsString);
var f3 = Number(this.getField("L1Lodge01BasicTotal").valueAsString);

if(f1&&f2&&f3){
 if(f1>=1 && f2>=1 && f3>=1)
 event.value = "Cornerstone Complete";
 else
 event.value = "Still Working";}
else
event.value = "";
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
New Here ,
Mar 28, 2023 Mar 28, 2023
LATEST

Thank you VERY VERY much Nesa!! This got me out of a big jam.

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