javascript for blank field validation on repeating subforms

Avatar

Avatar
Validate 10
Level 2
Jodi1725
Level 2

Likes

6 likes

Total Posts

113 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Jodi1725
Level 2

Likes

6 likes

Total Posts

113 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
Jodi1725
Level 2

29-01-2018

Hello All!

I have a form with repeating subforms.  You click a button and a second(or third)instance of a subform is generated.

I need to create javascript on a print button that verifies certain fields on each subform is filled in (name address, etc)

I found this doc Loop Through Subform Instances  that shows me how to loop thorough the subform and I can make it work for 1 field, but i have more than one field to validate.


Any idea how to write the javascript that can run through multiple fields on multiple subforms?

Thanks in advance!!!

Jodi

View Entire Topic

Avatar

Avatar
Validate 10
Level 2
Jodi1725
Level 2

Likes

6 likes

Total Posts

113 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Jodi1725
Level 2

Likes

6 likes

Total Posts

113 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
Jodi1725
Level 2

31-01-2018

I used this code

expenseReport.#subform[0].validate2::click – (JavaScript, client) 
var vItems = expenses.expense.all; 
for(i=0; i<vItems.length; i++) 

    if (vItems.item(i).description.rawValue == null) 
    { 
        xfa.host.messageBox("Missing description field"); 
        break; 
    } 
}

I had to put the vItems.item(i) for each of the fields.  when I did that it worked!