Highlighted

Changing Presence of Object in a Specific Subform Instance?

Avatar

Guest

08-02-2009

Hi,



I've been having a good deal of success manipulating subform object properties, But I've come accross a problem I just can't seem to solve.



I have a repeating tableRow that has a corresponding repeating subform (outside the table within a common parent subform. When the user selects a value from a dropdown list in one of the table row instances, properties in a corresponding subform with the exact same index.



So changes row[1] instance the desired effect would happen to the target object in subform[1]



What happens however, is that no matter the index of the table row, the effect always targets the first instance of the subforms. So, row[any] always targets TargetSubform[0].



I can remove specific corresponding instances together from either parent. I have tried variables, different ways of referring to the instance. If I manually put an index into square brackets (as below), it does work on the manually entered index for TargetSubform[] No syntax seems to work. I'm baffled. How do you get the current index for the instance you're using apply to the corresponding subform instance elsewhere?



My dropdown box script conditional statement has the following action. If I manually put an index number in the square brackets(as shown), it acts upon the manually specified target (in this case, instance[1] correctly. Try anything else and when it does work, it always acts on [0] instance, not the intended instance.



resolveNode("SubformCommonParent.TargetSubformChild[1].TargetObject").presence = "visible";

Replies

Highlighted

pguerett

09-02-2009

So you need to get the index of the row that you want to act on. If the dropdown is in each row you can use this.parent.index to return the index that you are on so combining that with your expression would yield:



resolveNode("SubformCommonParent.TargetSubformChild[" + this.parent.index + "].TargetObject").presence = "visible";
Highlighted

Avatar

Guest

09-02-2009

Paul,



Thanks for responding. Here is the actual code I am using. I've checked the properties on all the objects that are in play and cannot locate the problem. This is a rather large interactive form with a lot of interactive objects. I was doing great until I hit this snag--now I can't even get it to work by adding an index value manually!



ApplicationForLiability.Page1.SubformLiabilityCoverages.TableLiabilityCoverages.RowOptionalCoverage.DdlCoverageType::change - (JavaScript, client)

// Change the presence attribute of the fields.

if (this.rawValue == 1 || this.rawValue == 2) { // If 4-wheeler or Jetski is selected

resolveNode("SubformLiabilityCoverages.SubformOtherLiability[" + this.parent.index + "].ButtDelete").presence = "visible";

resolveNode("SubformLiabilityCoverages.SubformOtherLiability[" + this.parent.index + "].SubformRVLiability").presence = "visible";

//xfa.resolveNode("ApplicationForLiability.Page1.SubformLiabilityCoverages.SubformOtherLiability[" + this.parent.index + "].ButtDelete").presence = "visible";

//xfa.resolveNode("ApplicationForLiability.Page1.SubformLiabilityCoverages.SubformOtherLiability[" + this.parent.index + "].SubformRVLiability").presence = "visible";

}xfa.resolveNode("ApplicationForLiability.Page1.SubformLiabilityCoverages.SubformOtherLiability[" + this.parent.index + "].SubformRVLiability").presence = "visible";

}

ApplicationForLiability.Page1.SubformLiabilityCoverages.TableLiabilityCoverages.RowOptionalCoverage.DdlCoverageType::ready:layout - (JavaScript, client)

// Set the state of the conditional fields when the form is opened.

this.execEvent("change"); //Expose conditional fields



I tried the absolute SOM as well as the relative, with and without xfa. prefix, but I believe the problem lies elsewhere, right?



Stephen
Highlighted

Avatar

Guest

09-02-2009

Paul, looks like I pasted some of the code twice; this is what you suggested (and I don't understand why it doesn't work):



if (this.rawValue == 1 || this.rawValue == 2) { // If 4-wheeler or Jetski is selected

resolveNode("SubformLiabilityCoverages.SubformOtherLiability[" + this.parent.index + "].ButtDelete").presence = "visible";

resolveNode("SubformLiabilityCoverages.SubformOtherLiability[" + this.parent.index + "].SubformRVLiability").presence = "visible";

}
Highlighted

pguerett

10-02-2009

Can you send the form to Livecycle8@gmail.com along with a description on how to reproduce the issue and I will have a look at it.
Highlighted

Avatar

Guest

10-02-2009

Paul,



Thank you! for your interest in helping me solve the problem. I figured it out this morning. Its amazing how stepping away and getting some sleep allowed me to quickly spot the problem. I have a hard time stepping away when I get stuck.



I had an incorrect SOM for one of the buttons (ButtRemove vs ButtDelete). I thought I was being consistent in my naming--just shows how important it is to be consistent.



Stephen
Highlighted

Heavy_Paladin

26-05-2009

Dear all,

I need the same value for a global function, thanks for your input Paul, BUT how can I access the values in that form according to the passed index.

I mean how to access the form.Page1.subform.custname.rawValue ...??

How to put the index as parameter to that line ...

Best regards

Highlighted

pguerett

26-05-2009

The index will be on the repeating element ....in this case the subform. So the expression will be:

form.Page1.subform[0].custname.rawValue

But the index is usually a variable value derived from some other expression and the var will not be resolved in this format. So we can use the xfa.resolveNode("string") format to derive our expression. So if th eindex was contained in a var called j the syntax woudl be:

xfa.resolveNode("form.Page1.subform[" + j + "].custname").rawValue

Paul

Highlighted

Heavy_Paladin

26-05-2009

Hello Paul,

Thanks for your reply,

Actualy I figure out another way to complish my task by passing the row object to the function and it works fine.

Best regards