These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Drop a fragment into a form depending on a drop down list selection...

jbl.ctr
Registered: Mar 9 2010
Posts: 5
Answered

So I am new to working with Acrobat and have read alot of posts, but none seem to go over this specific topic. I have a form, a resource request form. For each resource that is requestable I have a set of fields grouped into a fragment. These fields vary from text to numeric to checkbox. I would like to avoid taking up all kinds of space by having to have a block designated to each resource and it's fragment of options. I was hoping I could setup a drop down list that would bring into the form the correct fragment for each of the resources upon the selection of the resource.

So it would work like this...

A user selects resource A from the drop down. Next to the dropdown feild the fragment with the options for that resource is populated on the form. below the drop down and the fagment another drop down , the same as before, pops up for the user to begin the process oer again should they require more resources.

This is a very complicated issue, i assume, but it would make the form far more user friendly. I appreciate any help that can be given.

Thanks in advance.

jbl.ctr
Registered: Mar 9 2010
Posts: 5
I noticed I had alot of reads but no replies so I hope to clarify my request with information I found online.

I have been searching still and found some classes, but of course no tutorials or guides, about "condiitonal subform fragments". These seem to be perfect. If upon the selection of the drop down box I could execute a call for the fragment based on the selection, ie the condition, and populate the subform region with the fragment I would be set.

Any help is greatly appreciated.
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi jbl.ctr,

Yes, you can create a form that will show different form fragments based on a user making a choice ( could be a drop down, radio button, checkbox). It is likely that the people who viewed your post found it too broad and too time consuming for a reply. Questions that can be answered concisely get the quickest replies- if it takes more than a few minutes it simply depends on if there is time in the day since this is a voluntary setup.

There are some examples in the Forms Gallery- check out the "Graphics Project Request" and
"Computer Setup Checklist." The layout, options, and code used in those forms is viewable.

Understanding how LiveCycle Designer forms are built is very important for your task. There are some on-demand e-seminars on LiveCycle Designer forms here in the Learning Center that you should watch before you get too far into this.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
jbl.ctr
Registered: Mar 9 2010
Posts: 5
Dimitri,

I appreciate you pointing me in the right direction. However I am having trouble figuring out how to get the Drop down list to kick off the script.

Right now I have tried to use that script with change, click, exit, mouseexit...

My script is this :

if (Terms1.rawValue == "TSTF") // Terms1 is the dropdown and TSTF is one fo the values
{
Fragment1[0].presence = "visible" // fragment of 12 feilds
Image1.presence = "visible" // text entry feild
Terms2.presence = "visible" // the next dropdown for another set of selections
} //if the user made one in Terms1
else
{
Fragment1[0].presence = "hidden"
Image1.presence = "hidden"
Terms2.presence = "hidden"
}

I would like to note that the dropdown and the feilds are in the same subform. So do I have to start the hidden or viosible change with the subform still? I have tried it both ways, but was curious.

Thanks very much for your time!
PJ_F
Registered: Dec 10 2009
Posts: 7
Hi,

I solved this problem. The fundamental you have to know is:

the change-event does not act as you expect. You get the old (former) value back. If you know what I mean.

solution:
I have a drop down box named "Anwendung". According to the decision there I change/switch dynamically between some fragments. These fragments reside inside a "roleset_choice"

Quote:
Userantrag.Global.header.Anwendung::change - (JavaScript, client)this.rawValue = this.xfa.event.newText;

switch (this.rawValue)
{
case "RBS" :
Userantrag.Global.roleset_choice.BPI.presence = "hidden";
Userantrag.Global.roleset_choice.SPRING.presence = "hidden";
Userantrag.Global.roleset_choice.FAKT.presence = "hidden";
Userantrag.Global.roleset_choice.RBS_1.presence = "visible";
break;
case "SPRING" :
Userantrag.Global.roleset_choice.BPI.presence = "hidden";
Userantrag.Global.roleset_choice.RBS_1.presence = "hidden";
Userantrag.Global.roleset_choice.FAKT.presence = "hidden";
Userantrag.Global.roleset_choice.SPRING.presence = "visible";
break;

and so on
It doesn´t matter where your fragments reside in the tree. I hope you can follow my bad english :-)

Please notice the first line "this.rawValue = this.xfa.event.newText;" This is the one which drives the thing to do what you expect!

Hope this helps.

greetings from germany
jbl.ctr
Registered: Mar 9 2010
Posts: 5
So I have used your script and my settings to create this:

form1.Resources.SubAFCPT.Terms1::change - (JavaScript, client)

this.rawValue=this.xfa.event.newText;

switch(this.rawValue)
{
case"TSTF":
form1.Resources.SubAFCPT.Fragment1[0].presence = "visible"
form1.Resources.SubAFCPT.Image1.presence = "visible"
form1.Resources.SubAFCPT.Terms2.presence = "visible"
break;
case"S281":
form1.Resources.SubAFCPT.Fragment1[0].presence = "hidden"
form1.Resources.SubAFCPT.Image1.presence = "hidden"
form1.Resources.SubAFCPT.Terms2.presence = "hidden"
break;
}

It still isn't changing the hidden entries to visible though. Perhaps it is the roleset_choice you mentioned. I can't find this anywhere. Is it a setting or a subformtype?

Thanks for all the help!
PJ_F
Registered: Dec 10 2009
Posts: 7
Hi jbl.ctr

I´ve uploaded a screenshot to my webspace - I hope this helps.

http://hackepeter.com/private/files/dynamic_insert_switch_1.gif

The code resides "in" the field called Anwendung. (1)

The chosen fragment is inserted in the layout at point (2) and the following fields "slide down"

maybe you forgot to set the content appearance wrong. "ALL" should be floating - NOT FIXED!

Let me know if you succeeded in overcoming the difficulties.

peter