Expand my Community achievements bar.

Change presence of all repeating subform instances

Avatar

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

Avatar

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

Avatar

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.

Avatar

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

Avatar

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.