Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

What is wrong with this resolveNodes script?

Avatar

Level 2

I have the code on a checkbox object in the mouseup event:

Outline is this:

form1

     mainForm

          subForm

               checkBox1

I plan on having many more subForms.

This is the script:

if  (this.rawValue == 1 || xfa.resolveNodes("mainForm.subForm[*]").checkBox1.rawValue ==1)

    xfa.resolveNodes("form1.mainForm.subForm[*]").border.fill.color.value = "180,180,180";

    else

    xfa.resolveNodes("form1.mainForm.subForm[*]").border.fill.color.value = "255,255,255";

When I click on this checkbox the mainForm background should turn gray.  Instead, it does nothing.  Anybody have any idea why this script does not work?

Thanks for any help!

1 Accepted Solution

Avatar

Correct answer by
Level 10

The resolveNodes method returns more than one object.If you want to set a field value in an instance, then you need to use resolveNode method.

But when you resolveNode method, you need to pass the index of the subForm. You can not pass [*]..

Probably based on your heirarchy, your code might need to look like this..

     var intIndex = this.parent.index;

     if  (this.rawValue == 1 || xfa.resolveNode("mainForm.subForm["+ intIndex +"]").checkBox1.rawValue ==1)

         xfa.resolveNode("form1.mainForm.subForm["+ intIndex +"]").border.fill.color.value = "180,180,180";

    else

         xfa.resolveNode("form1.mainForm.subForm["+ intIndex +"]").border.fill.color.value = "255,255,255";

Thanks

Srini

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

The resolveNodes method returns more than one object.If you want to set a field value in an instance, then you need to use resolveNode method.

But when you resolveNode method, you need to pass the index of the subForm. You can not pass [*]..

Probably based on your heirarchy, your code might need to look like this..

     var intIndex = this.parent.index;

     if  (this.rawValue == 1 || xfa.resolveNode("mainForm.subForm["+ intIndex +"]").checkBox1.rawValue ==1)

         xfa.resolveNode("form1.mainForm.subForm["+ intIndex +"]").border.fill.color.value = "180,180,180";

    else

         xfa.resolveNode("form1.mainForm.subForm["+ intIndex +"]").border.fill.color.value = "255,255,255";

Thanks

Srini

Avatar

Level 2

YES!!!!  That did the trick!!!  Thank you Srini!