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

Using multiple checkboxes to show/hide multiple pages

stellarceo
Registered: Jan 12 2009
Posts: 8

Hello All,

Have been trying to crack this for the past 3 days and no luck:(

I have 4 checkboxes on page 1 and each checkbox represents the following:

Checkbox 1 = Page 2
Checkbox 2 = Page 3
Checkbox 3 = Page 4
Checkbox 4 = Page 5

When each checkbox is selected then the corresponding page should be visable. A user may select checkbox 1 and checkbox 4 to view pages 2 and 5.

I have found variations of this using fields and no go. I appreciate the help.

BG

Bill G.

My Product Information:
LiveCycle Designer, Windows
nattyp
Registered: Jul 14 2009
Posts: 11
Change your check boxes to radio buttons. Put each radio button in a separate group. The Javascript script, click event, could be:

if(radiobutton1.rawValue==1){page2.presence="visible";}else{page2.presence="hidden";}

this would apply for all buttons ( similar script depending upon object group name) eg.

if(radiobutton2.rawValue==1){page3.presence="visible";}else{page3.presence="hidden";} and so on.

Not sure if this helps in anyway. As long as your page is set up correctly it should work.
stellarceo
Registered: Jan 12 2009
Posts: 8
Natty, thank you for your response. Ufortunately the script did not work, nothing changed:( I changed each checkbox into a radiobutton field and put each radiobutton in its own group:

Radiobutton 1 = ButtonList1.REORes - Needs to go to page>> InvestorParameterP1=Pg2
Radiobutton 2 = ButtonList2.REOCom - Needs to go to page>> InvestorParameterP2=Pg3
Radiobutton 3 = ButtonList3.NoteRes - Needs to go to page>> InvestorParameterP3=pg4
Radiobutton 4 = ButtonList4.NoteCom - Needs to go to page>> InvestorParameterP4=Pg5The radiobuttons are on Pg1 and the document has 5 pages total.

The code is in Java:
For Radiobutton 1:
if (form1.#subform[0].ButtonList1.REORes.rawValue == 1)
{form1.InvestorParameterP1.presence = "visible";}
else
{form1.InvestorParameterP1.presence = "hidden";}


For Radiobutton 2:
if (form1.#subform[0].ButtonList2.REOCom.rawValue == 1)
{form1.InvestorParameterP2.presence = "visible";}
else
{form1.InvestorParameterP2.presence = "hidden";}

For Radiobutton 3:
if (form1.#subform[0].ButtonList3.NoteRes.rawValue == 1)
{form1.InvestorParameterP3.presence = "visible";}
else
{form1.InvestorParameterP3.presence = "hidden";}

For Radiobutton 4:
if (form1.#subform[0].ButtonList4.NoteCom.rawValue == 1)
{form1.InvestorParameterP4.presence = "visible";}
else
{form1.InvestorParameterP4.presence = "hidden";}

Binding values are set to "1".

If I use only one radiobutton for each selection how do you untoggle if user changes their mind? Also, do I need to use "xfa.layout.relayout();" at all? I have seen this at the end of the "presence".

Thanks,

BG

Bill G.

nattyp
Registered: Jul 14 2009
Posts: 11
Hi BG,

I've just found a document I had saved that used check boxes instead of radio buttons and it works fine so you can do it principles are the the same as the radio button script.

I'm not sure if this is any help. I made notes for other memebers of my team when I was setting up a flowed document with show /hide functions. Was a first time for me and i'm a basic user. I found that if i placed all the subforms under page 1 things worked a lot better and made the scripting simpler. Selections may be undone by clicking a radio button again the document will hide/show ( not the best option but it works sort of). Thats about all i have sorry to help with your problem.


Flowed doc’s

Set up page as below:

Master page then a main subform(head).

For Flowed docs the Logos need to be on the design page not the master page otherwise the logos will appear on every page.

The head subform needs to be set to flowed to do this click on the head title on the hierarchy palette the over in the object palette select subforms tab it will be defaulted to positioned.
An additional subform can be inserted below the head form call this page 1 set it position to flowed also. This enables subforms that fall underneath to take up the space of other excluded subforms thus eliminating the white space.

Below the page1 subform additional subforms are added, directly below the head form for multiple pages or below s1 or s5 if they are to appear on that specific page. These subforms need to be set to positioned
By breaking the document up into separate subforms it will be easier to hide different sections for different selections.

Use a radio button exclusion groups when you want a section to appear based on a selection. For example a control group with a selection of
Admin Educational Operational
Rawvalue 1 Rawvalue 2 Rawvalue 3
Rawvalues will then apply to the radio button control group make sure you check the value in the value tab of the object palette. This assists with the scripts that apply to each radio button.
The script is a ‘click event’ in “java script” An example of the scripting:

If(name.rawvalue==1){s2.presence=”visible”}else{s2.presence=”hidden”}

This applies to all other sections you wish to appear when the selection is made however for some reason the script changes slightly to:

if(name.rawValue==1){s2.presence="visible";}else{s2.presence="hidden";}{s3.presence="hidden"}{s4.presence="visible";}{s5.presence="visible";}
Hidden sections can also be added within subforms eg. If a radio control group a selection of “no” is made a pop up of ‘please specify’ can be initiated. A script would be applied to the no button and the visibility of the field would be excluded from the layout.

Once all sections have been completed then comes the fun bit. To hide fields or subforms you need to be in the object palette, it’s the first tab(has many names, subform, field or name. At the bottom of the tab is a section called presence you need to select ‘hidden (exclude from layout’)

First you need to hide the fields within the subform that have separate hiding functions. i.e excluded from the layout of that section until a selection has been made from the selection that was originally hidden.

Then you hide the page subforms ie hiding S1 and S5 will hide the entire contents of those subforms or you may only wish to hide certain subforms contained within so you would then only hide those particular ones.

If the section you wish to populate is on another page you will need to specify its location. The script will change to:
if(name.rawValue==2){s1.s4.notapproved.presence="visible";}else{s1.s4.notapproved.presence="hidden";}