Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Select all instances of cells form a dynamic table

Avatar

Former Community Member

HI,

I've an issue with a table.

I've found some answers here : http://forums.adobe.com/thread/849841 but don't work.

Let me explain.

I've got a dynamic table (with addInstance button and remove one).

There is 4 columns: 2 open and 2 readOnly.

Some users are allowed to change the readOnly ones.

Then, I've created a password field.

with :

if (formulaire1.titre.pw.pass.rawValue == "123")

{
and here... I'm bloqued
}
I've tried :
for (i=0;i<=formulaire1.check.tab1.r1.instanceManager.count;i++){

     xfa.resolveNode{"formulaire1.check.tab1.r1.[" + i + "].materiel").access = "open" ;

}

but failed (notting happend)

I've tried :

xfa.formulaire1.check.tab1.r1.resolveNodes("materiel[*]").access = "open";

failled, too

I've tried just : formulaire1.check.tab1.r1.materiel.access = "open";
Just open the first instance...
I'm not developper just designer... And here, I'm lost.
Thanks to help me.
Nath_lost

5 Replies

Avatar

Level 10

Hi,

The finished version of the SOM Expression example is here: http://assure.ly/kUP02y.

Try this in the exit event of the pass object:

var nMateriel = xfa.resolveNodes("formulaire1.check.tab1.r1[*].materiel");

var nFinishes = xfa.resolveNodes("formulaire1.check.tab1.r1[*].finishes");

if (this.rawValue == "123") {

     for (var i=0; i<nMateriel.length; i++) {

          nMateriel.item(i).access = "open";

          nFinishes.item(i).access = "open";

     }

}

else  {

     for (var i=0; i<nMateriel.length; i++) {

          nMateriel.item(i).access = "readOnly";

          nFinishes.item(i).access = "readOnly";

     }

}

This covers the material object and a fictional "finishes" to represent the second object that you want to set to open.

Also in your for script you were using an "i" variable, but you did not declare it, eg "var i=0". This is a hit on performance.

Hope that helps,

Niall

Message was edited by: Niall O'Donovan: there was an extra . in the xfa.resolveNodes. r1.[*] should have read r1[*].

Avatar

Former Community Member

Hi Niall,

Thanks for your rapid answer

But it didn't work. It just open the first instance... is it because passfield is in an other subform than table ?

Thanks a lot.

Nath

Avatar

Level 10

Can you recheck the script? There was an extra dot in the xfa.resolveNode and xfa.resolveNodes. "r1.[*]" should read "r1[*]".

Niall

Avatar

Former Community Member

I can't find this extra dot... May I send U my file ?

Avatar

Level 10

Hi,

Google Chrome1.png

I have removed it from my sample script.

If you upload the form to Acrobat.com, publish it and then share the published link here.

Niall