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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Change presence of all repeating subform instances

FloridaWriter
Level 2
Level 2

I have a repeating subform that contains two subforms: 1 is visible and 1 is hidden. I need a script to change all instances of the hidden subform to visible.

The form starts as a Request for Quote, which is filled out by our customer and e-mailed to us. The customer may open up several instances of the visible subform before sending the form back to us.  We then fill in the quote section and return the form to the customer.  If the customer agrees to accept our quote, the customer will click a checkbox to reveal the hidden subform instances so he can fill in those fields and e-mail the form back to us. (The checkbox is in a completely different subform.)  I have not been able to find a script (that actually works) that reveals the all instances of the hidden subform.

The scripts I have tried only reveal the first instance of the hidden subform.

4 Replies
Niall_O_Donovan
Level 10
Level 10

Hi,

Well getting the script to change the first instance at least shows that the relative references are correct.

Basically if you are using JavaScript then you would need a loop to work through all of the instances. Lets say the repeating subform is called "repeatSubform" and the hidden subform is called "hiddenSubform".

Then something close to this should work:

var oSubform = xfa.resolveNodes("page1.repeatSubform[*].hiddenSubform");

for (var i=0; i<oSubform; i++) {

     oSubform.presence = "visible";

}

There is a discussion here on references and resolving nodes: http://assure.ly/kUP02y.

Good luck,

Niall

FloridaWriter
Level 2
Level 2

I wish I could say that this works, but it doesn't.  I've spent 3 weeks searching the web, forums and everything else I can think of for the answer.  Thank you for your reply, though.

Niall_O_Donovan
Level 10
Level 10

Hi,

Are you getting an error when you click the button (in the JavaScript Console - Control+J)?

You will have to change the relative reference to the hidden subform, to suit your form structure.

Niall

FloridaWriter
Level 2
Level 2

I came across another person's post on a different forum.  His solution for his problem (similar to mine, but not identical), was to use FormCalc.  Wow!  So simple.  Here is what I put in the checkbox "click" event:

form1.UppermostSubform.Page1Subform.puSUBFORM[*].PUhidden.presence = "visible"

This makes all instances of the hidden subforms visible.