Expand my Community achievements bar.

Action on subform?

Avatar

Former Community Member

Can I add a action on a subform somehow.

In my form it depends what column you enter then some other columns should be disabled.

I can put a action on one field and get a subform disabled. But I can not put a action on a subform.

That means I have to put this action on so many fields it gonna take me one day to do it.

Is there a way to put a action on a subform or multiple fields?

/ Anders

Sweden

12 Replies

Avatar

Level 10

Hi,

It depends on what version of LC Designer you have AND what version of Acrobat/Reader that the users have.

One method would be to propagate the event. See here: http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000018.html.

You would place generic script in the exit event of the subform and enable propagation for that script. This would mean that the script would fire as the user exits any field within that subform.

Please note that you would need to keep the script generic, so that for example this.rawValue would refer to the value of the field just exited.

Also the form would need to be opened in Acrobat/Reader v9.1 or above, as event propagation is not supported in earlier versions.

Hope that helps,

Niall

Avatar

Former Community Member

Hello,

Thank you.

Im preety new to this but I been trying and googling this.

First it seems that the button for propagation is removed in my version of LC. Something I see people talking about was done in SP2.

But I found out that I could edit the XML. Something I dont know anything about but always fun to try.

So what I want to do is to fill any of the fields in clumn 1 and then all the fields in column 2 is disabled.

And as I understand the script should look something like this.

<event activity="exit" name="event__exit" listen="refAndDescendents">

followed of he script created with the action builder?

Well it doesn´t work so is there something easy to fix here?

/ Anders

Sweden

Avatar

Level 10

Hi,

You can add the propagation instruction in the XML Source, but proceed with caution.

The latest version of LC Designer (v10), you can turn on the option for Event Propagation in the Tools > Options dialog:

Parallels Desktop1.png

I am not sure that you will get the propagation to work from the Action Builder. You may need to add the script yourself, directing into an appropriate event in the Script Editor.

Hope that helps,

Niall

Avatar

Former Community Member

Thanks.

I´ve downloaded the trial of ES3 and I got the button. THough it looks like you say that the action builder doesn´t seem to work with the button.

Thanks for your help anyway

/ Anders

Sweden

Avatar

Level 10

Hi Anders,

It is not a big/insurmountable step to create your own script, instead of using Action Builder.

Let's say TextField1 is in the first column and TextField2 is in the second column. The following JavaScript in the exit event of the subform (propagated) should work:

if (xfa.event.target.name === "TextField1") {

     if (xfa.event.target.rawValue === null) {

          var vRow = xfa.event.target.parent.index;

          xfa.resolveNode("Row1[" + vRow + "].TextField2").access = "open";

     }

     else {

          var vRow = xfa.event.target.parent.index;

          xfa.resolveNode("Row1[" + vRow + "].TextField2").access = "readOnly";

     }

}

Okay, it might seem a little involved and the script above will depend on your form's structure. But the message should be that it is possible.

Hope that helps,

Niall

Avatar

Former Community Member

Many thanks,

Is it possible for me to create just a couple of text fields with these names and just paste this into the script editor? Just to start learning a little.

/Anders

Sweden

Avatar

Level 10

Hi Anders,

There is a working example here: http://assure.ly/LucDMf.

Hope that helps,

Niall

Avatar

Former Community Member

Thanks so much for talking your time.

I actually think I understand some. I will try to create the same form as you did and see if I can be successful.

Thanks again

/Anders

Sweden

Avatar

Former Community Member

I been playing around with this and have to say I got some things working.

One little question though.

If I want this to happen.

If one field in column 1 is entered with text then all fields in column 2 should be disabled.

Doesn´t matter what row is entered in colmn 1.Template.JPG

Just put a image of the form Im working on.

Anders

Sweden

Avatar

Level 10

Hi Anders,

Yes, it would be posible to extend the script, so that it loops through all of the rows. However I would need to see the structure of the form and whether the table contained a static number of rows or could the user add more rows.

Niall

Avatar

Former Community Member

Thank you for your answer.

Im gonna remake make form with the structure you used in your example. Just insert a table.

The user will not be able to add any rows. So if we used your first example but by filling in any of the rows in column 1 would disable all of the rows in column to and viceversa.

/ Anders

Sweden

Avatar

Level 10

Hi Anders,

Have a good look at this amended example: http://assure.ly/LWbvj8. It has the functionality you require, you just need to extend it to the number of objects in each row.

Be sure to have a look at this discussion on SOM Expressions and xfa.resolveNode/xfa.resolveNodes: http://assure.ly/kUP02y.

Hope that helps,

Niall