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

Subform displays based on dropdown choice

CAMM
Registered: Nov 3 2010
Posts: 11
Answered

Greetings,
 
I have used Acrobat for quite some time and have used other scripting/programming languages, but I am new to creating forms and Live Cycle Designer.
First I have to say thanks for the assistance I have already gotten from the user community by reading the posted info.
I am currently trying to display an appropriate chart on a form based on the users' selection from a drop down.
I have seen several postings that are related, but not quite what I wanted to do and I've been close to the solution using several different methods, but haven't quite hit it. I've read a lot of the Adobe documentation also, but I feel I am missing some connecting piece - I know it shouldn't be this complicated.
Can anyone advise a methodology or direct me to perhaps a more step by step tutorial.....subform set? and if so how to link to the drop down choice as opposed to a data set.........change events of a drop down and "presence" of text? - I'm working on it, but seems like a lot of Java script(which I am new to, but willing to learn)......better way?
 
I am currently using PRO 9, but may be getting X shortly where I believe "Actions" may help.
 
Thanks,
CAMM

CAMM

My Product Information:
LiveCycle Designer, Windows
DaveyB
Registered: Dec 10 2010
Posts: 70
This is easy to accomplish using javascript, and with a minimal learning curve too! :)

In the on-exit event for the drop-down just use a javascript switch statement to display the appropriate form. The initial "switch(YourFieldName)" starts the process off, and since it is a dropdown, there is a corresponding "case" statement for each possible value. You can optionally omit the "default" statement if the choices are limited to what is in the dropdown.Each "case" statement takes a single option, and then displays the appropriate subform(s) for that option. Use of the "break;" statement after each "case" statement takes the logical path out of the "switch" statement once a successful match is found. It is also possible to build such a "switch" to execute several cases in one pass by leaving out the "break;".

Javascript isn't there to perplex you, it's there to help. The W3 Schools site I linked above is a great resource for learning just what you need to know and answering questions you may have!

Hope that helps!

DaveyB

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB

CAMM
Registered: Nov 3 2010
Posts: 11
Thank You DaveyB for quick response.
I tried something like this:

form1.#subform[0].DD1::exit - (JavaScript, client)
switch (DD1)
{
case 1:
T1.presence = "visible"
break;
case 2:
T2.presence = "visible"
break;
case 3:
T3.presence = "visible";
}


DD1 being the drop down and text T1, T2, T3. I also tried the text to be displayed as textfield or text wrapped in a subform.
...no luck....should my case test the VALUE or the TEXT from the drop down?


I also tried:

if (this.rawValue=="1")
T1.presence = "visible";

on the exit event of a textfield to test something I had seen written about earlier here and I had no luck with that.
Any thoughts - it is probably fairly obvious, but I think I have been looking at it too long :(
??

Thanks in advance!
CAMM





CAMM

DaveyB
Registered: Dec 10 2010
Posts: 70
Accepted Answer
Your switch statement is fine, other than missing a couple of semi-colons (javascript requires them while formcalc doesn't, but I'm assuming they were left off by accident when you typed the post ^^ ). The problem lies in the code executed by the switch statement.

There's nothing better than a working example to play with, so take a look at DropDownListValues.pdf, save it to disk and open it with LC to access the scripts under the 'change' event for the dropdown list. Note the format used to address the fields - this is javascript, not formcalc, so the syntax is different.This will also answer your question about testing the VALUE or the TEXT :)

Hope that helps you out !

DaveyB

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB

CAMM
Registered: Nov 3 2010
Posts: 11
Thanks DaveyB!
The document that you pointed me to was a very good example that tied a few things together for me as far as referencing the fields properly. I have the transfer of the text values working and now I just have to play with the visibility factor.
Thanks for your assistance.

CAMM

CAMM