Expand my Community achievements bar.

SOLVED

Buttons and Sub Forms

Avatar

Former Community Member

Been new to LiveCycle, I have managed to create some basic forms but would like to know the best way of creating a menu and depending on which menu choice the user makes then only subform appears and the others are invisible. So if the user is offered options A B or C and selects B then they are then taken to that Subform. Any help will be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If you send it to nodonovan.livecycle@gmail.com I will try and look at it later.

Niall

View solution in original post

10 Replies

Avatar

Level 10

Hi,

You can script to change the presence of objects depending on users actions. Here is an example: https://acrobat.com/#d=txGF4IAoqmfTKPrLkwybIA

In this case all subforms are visible when the form is opened, so that you can see the layout and sequence of the subforms. Then appropriate ones are shown/hidden depending on users actions.

Note the difference in invisible and hidden. When using the hidden property you need to make sure that the containing subform is flowed, to allow objects to flow up to take the space that the hidden object was using.

Hope that helps,

Niall

Avatar

Former Community Member

Hi Niall, Thanks for the prompt response, what i am not sure on is if I put the drop down list on Page 1 and Options A, B + C are on Page 3, 5 & 6 how I would do this as I am not exactly sure how sub forms work, would I have to create subforms on every page.

Avatar

Level 10

Hi,

LC Designer can handle this, you just need to give a full enough reference to the object that you want to access.

So for example if the subform was on page5 and the dropdown was on page1, the script in the dropdown would look something like this:

page5.flowedSubform.optionA.presence = "hidden";

You drag on subforms where you want to group objects, so that for example you can change their presence or have flowed content. You don't have to create subforms - you can just drag objects onto the page and access them individually. Its up to you.

There are various online guides on the Adobe website.

http://www.adobe.com/go/learn_lc_scriptingBasics

http://www.adobe.com/go/learn_lc_scriptingReference

http://www.adobe.com/go/learn_lc_formCalc

http://www.adobe.com/devnet/livecycle/articles/Adobe_XML_Form_Object_M odel_Refer ence.pdf

http://www.adobe.com/devnet/acrobat/pdfs/lc_migrating_acrobat_xmlform. pdf

And a very handy resource (and while it is for version 6 it is still very good because of the way it is laid out):http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

JP Terry's book on LC Forms is very good and we use www.pdfscripting.com (which is a subscription service).

The help file also helps with syntax and LC Designer comes with templates/examples.

Lastly, check out the Developer's Network on http://www.adobe.com/devnet/livecycle/

Hope that helps,

Niall

Avatar

Former Community Member

Hi Niall,

Thanks for the assistance but still cannot get the script to run.

Avatar

Level 10

Hi,

Can you share your form on Acrobat.com or another file sharing site?

Niall

Avatar

Former Community Member

Here is the code that I have compiled

TopmostSubform.Page1.DropDownList2::exit - (JavaScript, client)

switch (this.rawValue)

{

case "Section B":

page2.positionedSubform.optionB.presence = "visible";

page3.positionedSubform.optionB1.presence = "visible";

page4.positionedSubform.optionC.presence = "invisible";

page5.positionedSubform.optionD.presence = "invisible";

break;

case "Section C":

page2.positionedSubform.optionB.presence = "invisible";

page3.positionedSubform.optionB1.presence = "invisible";

page5.positionedSubform.optionD.presence = "invisible";

page4.positionedSubform.optionC.presence = "visible";

break;

case "Section D":

page2.positionedSubform.optionB.presence = "invisible";

page3.positionedSubform.optionB1.presence = "invisible";

page4.positionedSubform.optionC.presence = "invisible";

page5.positionedSubform.optionD.presence = "visible";

break; }

Hopefully you will be able to spot a beginners mistake.

Thanks

Avatar

Level 10

Hi,

Have a look at the dropdown:

  1. Make sure that the display items match the values you are using in the switch statement (or make sure that the values in the script match the display list items: Object > Field tab).
  2. Then in the Object > Binding tab make sure that "specify values" is NOT ticked.
  3. Save the form as a Dynamic XML form.

The script looks okay, make sure that the object references are correct.

When previewing the form press Control+J to open the javascript console. When you interact with the form any errors will show up in the console, indicating where the problem may be.

Hope that helps,

Niall

Avatar

Former Community Member

Hi Niall,


Checked all the items you suggested , and the java console doesn't show any errors so not sure it is even running the script.

Do you have an email address I could send the form to for you to have a quick look?

Thanks

Avatar

Correct answer by
Level 10

Hi,

If you send it to nodonovan.livecycle@gmail.com I will try and look at it later.

Niall

Avatar

Former Community Member

Hi Niall,

Just a quick message to say thanks for all your help and assistance.

Steve