Expand my Community achievements bar.

Attaching script to one item in drop down list

Avatar

Former Community Member
Hi all.

I'm still pretty new (and bad) with JavaScript.

I've figured a bunch out recently, but I'm stumped on how to attach a scripted action to a particular selection in a data drop down list.

My drop down list is "payment type" and when "ACH account" is selected, I want to make visible my "ACH Payment ID#" field which is hiding just below.

If anyone can help I would very greatly appreciate it.



Also, if anyone has any suggestions for a good reference source that will help with the Designer specific SOM (other than the SOM itself) I would be eternally grateful. I have several books that deal with scripting in Acrobat -but they changed all the rules with the xdp based Designer and none of the scripting in those books works any more.



Thanks!

Jennifer
8 Replies

Avatar

Former Community Member
Jennifer,




Click on this link, you can find an example that is similar to what you are trying to do.



It is the "Drop-box List on Change event" example

Avatar

Former Community Member
There seems to be a bug here. As jimmyphan has in his example, use the change event and retreive the selected item using "xfa.event.newText".



This works, but when I do a test for the ACH Account and set the presence property to display the hidden field, Acrobat will hang.



Does this happen for anyone else?

Avatar

Former Community Member
As for documentation, the only source for SOM specific stuff is the XFA object model reference document. It can be found at http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pdf



It is more of a reference but it is better than the Designer Help Files

Avatar

Former Community Member
Hi David,



How about trying something like this for the drop downlist.



switch (xfa.event.newText)

{

case "AAA account":

xfa.form.form1.subform1.TextField1.presence = "invisible";

break;

case "BBB account":

xfa.form.form1.subform1.TextField1.presence = "invisible";

break;

case "ACH account":

TextField1.rawValue = xfa.event.newText;

break;

}

Avatar

Former Community Member
Hi David,



How about trying something like this for the drop downlist with its "presence" property set with "visible" initially.



switch (xfa.event.newText)

{

case "AAA account":

xfa.form.form1.subform1.TextField1.presence = "invisible";

break;

case "BBB account":

xfa.form.form1.subform1.TextField1.presence = "invisible";

break;

case "ACH account":

TextField1.rawValue = xfa.event.newText;

break;

}

Avatar

Former Community Member
Ah found it! Weird behaviour.



If you have the textfield after the drop-down list box (containing the script for the change event) in the hierarchy view, then Acrobat will hang. If the text-field is before the drop-down list box, then it works correctly.



Just make sure you have the objects you wish to dynamically show/hide via script come before the objects containing script.

Avatar

Former Community Member
Thanks! I got it to work. I never would've figured out that the order on the hierarchy would affect the scripting. Guess I need to go check a few other spots where I've been experiencing hang-ups with scripts.

I thought it's just been bad scripting on my part!

Jennifer

Avatar

Former Community Member
Hi jimmypham, David



I want to show a drop down list box "list2" when I select "LC at Sight" in the first drop down list box "list1".



List2 is invisible when I run the form.



I am using livecycle ES 8.2



Please help how can I do that..



Also, jimmypham you above link to download example form does not work..please give the working link..



kind regards

Asim