Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

I need some help to make a text field mandatory if a check box has been ticked, I keep getting a SyntaxError: missing ; before statement 3: at line 4

KevinTucker-bwc
Level 1
Level 1

if(this.rawValue =='Yes')
{
app.016Description0.mandatory = "error";

app.017EASAReference0.mandatory = "error";

app.018ComplianceStatement0.mandatory = "error";

app.019SupportingDocs0.mandatory = "error"


app.016Description0.mandatory.border.edge.color.value = "225,0,0";

app.017EASAReference0.mandatory.border.edge.color.value = "225,0,0";

app.018ComplianceStatement0.mandatory.border.edge.color.value = "225,0,0";

app.019SupportingDocs0.border.edge.color.value = "225,0,0";

}
else{

app.016Description0.mandatory = "disabled";

app.017EASAReference0.mandatory = "disabled";

app.018ComplianceStatement0.mandatory = "disabled";

app.019SupportingDocs0.mandatory = "disabled";


app.016Description0.mandatory.border.edge.color.value = "225,0,0";

app.017EASAReference0.mandatory.border.edge.color.value = "225,0,0";

app.018ComplianceStatement0.mandatory.border.edge.color.value = "225,0,0";

app.019SupportingDocs0.border.edge.color.value = "225,0,0";

}

1 Accepted Solution
_Bruce_Robertson
Correct answer by
Level 10
Level 10

Hi,

There are a few differences in the allowable names for an XFA field and for a JavaScript object and having a full stop in a name is one of them.  In JavaScript you would have to reference the field as a property of it's parent so if the field app.016Description0 has a parent Page1 then you could use Page1["app.016Description0"].

But I would rename your XFA fields.

Regards

Bruce

View solution in original post

3 Replies
try67
Level 4
Level 4

From your code I'm assuming you have an LCD form, so I'm moving this thread to the relevant forum.

_Bruce_Robertson
Correct answer by
Level 10
Level 10

Hi,

There are a few differences in the allowable names for an XFA field and for a JavaScript object and having a full stop in a name is one of them.  In JavaScript you would have to reference the field as a property of it's parent so if the field app.016Description0 has a parent Page1 then you could use Page1["app.016Description0"].

But I would rename your XFA fields.

Regards

Bruce

View solution in original post

KevinTucker-bwc
Level 1
Level 1

Many thanks Bruce, after some experimenting I think I've cracked it