setInstance issue with 3 subforms


hi

i'm trying create form users can enter details courses. there function can select course type drop down menu, , depending on select subform displayed underneath.

if (this.rawvalue == "vet") { form1.page2.coursedetail._coursedetailvet.setinstances(1);
form1.page2.coursedetail._coursedetailothers.setinstances(0);
}
if (this.rawvalue == "neas" ||this.rawvalue == "uni"||this.rawvalue == "he"||this.rawvalue == "schools") { form1.page2.coursedetail._coursedetailothers.setinstances(1);
form1.page2.coursedetail._coursedetailvet.setinstances(0);
}

i can working fine.

i have "add course" button @ end of course details. adds instance of first course details.

form1.page2._coursedetail.addinstance(1);

it adds initial course fields fine, when select course type drop down field, instead of subform displaying underneath newly added course, effects subform previous course details.

the way have set hierachy this:

>indicates subform

page 2 (set flow content)
>course detail (set flow content)
>>coursedetailbody (set position content)
>>coursedetailvet(set position content)
>>coursedetailothers(set position content)
>coursedetailadd(set position content)

i'm not sure if i'm setting correctly, able help?
hope i've provided enough information , question makes sense.
i've tried mixing hierachy seemed having subform within subform worked best.

when have 2 instances of same subform, if use absolute references subform, have start using indexes different subform instances. ie coursedetail[1]

if reference subform using name without index, default first subform instance.

so, when use
i form1.page2.coursedetail._coursedetailothers.setinstances(1);
it grabbing coursedetails subform @ index 0 - ie first instance added

(there bunch of rules referencing nodes - see http://partners.adobe.com/public/developer/en/xml/som_2.0.pdf).

a way resolve change suform references use relative references rather absolute references.

so instead of :

> form1.page2.coursedetail._coursedetailothers.setinstances(1);

you may use (depending on drop down is):

> this.parent.parent._coursedetailothers.setinstances(1);

you subform node index using

> this.parent.index;

and build reference subform want using resolvenode method

something like:

> form1.page2.resolvenode("coursedetail[" +
> this.parent.index + "]")._coursedetailothers.setinstances(1);

but stick relative reference method.

i hope helps , clear, it's hard explain without demonstrating mean.

regards
anthony jereley
indigo pacific pty ltd


More discussions in LiveCycle pre-ES (6.x and 7.x) discussions


adobe

Comments