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

Avatar

Avatar
Validate 1
Level 1
KevinTucker-bwc
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
KevinTucker-bwc
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
KevinTucker-bwc
Level 1

01-10-2015

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";

}

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

01-10-2015

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

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
Level 1
KevinTucker-bwc
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
KevinTucker-bwc
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
KevinTucker-bwc
Level 1

02-10-2015

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

Avatar

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
try67
Level 2

01-10-2015

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