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

SubForm's Loop and hiding based on checkbox

Avatar

Avatar
Validate 1
Level 1
jasons17295687
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jasons17295687
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jasons17295687
Level 1

18-02-2016

I have a form where sub forms have a check box in them.  I need a script when the user clicks a button to hide all sub forms that don't have the check box checked.  Thanks for any assistance you can provide.

var allChildElements;

var intNumElements;

var currentElement;

var i;

allChildElements = CRT130.nodes;

intNumElements = allChildElements.length;

for (i=0; i<intNumElements; i++)

{

currentElement = allChildElements.item(i);

if(currentElement.className === "checkbox")

{

  if(currentElement.rawValue == 0)

  {

  currentElement.presence = "hidden";

  }

}

}

Heirarchy.png

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,072 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,072 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile
Magus069
MVP

18-02-2016

Hi there,

the className of a checkbox is "field", if you want to verify if the item is a checkbox, you have to access to the ui's field to be able to verify what kind of field it is.

Although for a checkbox the className is checkButton instead of checkbox.

You would need to create a recursive function to loop through each subform and also each items within the subform.

Create a script object (xfaCheckBoxes) with the function above within, and then you can call the function on the button's click event

This should do the trick,

I hope it will help!

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
jasons17295687
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jasons17295687
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jasons17295687
Level 1

18-02-2016

Works great thank you very much!  I had been going around and around with this one.