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

Dynamic subform validation

Avatar

Avatar
Validate 1
Level 2
SnookerDJ
Level 2

Like

1 like

Total Posts

108 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
SnookerDJ
Level 2

Like

1 like

Total Posts

108 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
SnookerDJ
Level 2

13-02-2009

Hi there



I have a form that when you click a button it repeats an instance of a subform.



I have also added an additional 'validation' button so that it checks that some of the fields in the subform are filled in. I have used some JavaScript for this. The validation works fine on the first instance. However, it does not work on the second instance on the subform. I know that somehow I must get the script to check for extra instances but I cannot work it out.



Any help would be greatly appreciated.



Thanks

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

13-02-2009

You will have to put your code in a for loop where you can get the count of subforms to test. Now that you know the number of times to loop through the for loop, you can access each individual item of the subform using this notation:



form1.Page1.subform1.repeatingsubform[x].fieldname.property/method



To be able to derive the Som Expression and use the counter in the for loop you can use this notatoin:



xfa.resolveNode("form1.Page1.subform1.repeatingsubform[" + counter + "]").fieldname.....



This allows your expression to increment as the counter increments and will update each row as required. Note that the instance numbers are 0 based.

Avatar

Avatar
Validate 1
Level 2
SnookerDJ
Level 2

Like

1 like

Total Posts

108 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
SnookerDJ
Level 2

Like

1 like

Total Posts

108 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
SnookerDJ
Level 2

13-02-2009

Hi Paul



Many thanks for your reply. I am new to LiveCycle and picking up things and learning as I go along so I didnt fully grasp where to input the code or if it needs to go into a different event. Would you be able to put your example into context with the validation script I have runnning on the click event of a button in my form.



if ((HigherEducationPage.QualificationSubform.course.rawValue == null) || (HigherEducationPage.QualificationSubform.course.rawValue == "")) {

app.alert("Please enter your course in Section 1 of this form.");



Many thanks



Darren

Avatar

Avatar
Validate 1
Level 2
SnookerDJ
Level 2

Like

1 like

Total Posts

108 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
SnookerDJ
Level 2

Like

1 like

Total Posts

108 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
SnookerDJ
Level 2

13-02-2009

Also can you explain how the for loop works as well and where I would need to add it in.



Thanks again



Darren

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

13-02-2009

It woudl be easier to add the code and show you that way. If you send the file to livecycle8@gmail.com I will add the code when I get a chance.