Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-11-2012, 09:11 PM   PM User | #1
fogharty
New to the CF scene

 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
fogharty is an unknown quantity at this point
Acrobat X: display/hide fields via Javascript

I need help with a script that I cobbled together from an example script; I'm not good enough at java to edit it for my needs.

I have a form where I would like different drop down fields would be visible/hidden depending on the choices made from other drop down menus.

If (for example) they select paper type "white" or "color" then "white" will result in a second menu of paper choices, the "color" selection result in them picking the paper wieght, then from there the color.

My problem stems from the fact that my form is very linited in space, so I would like some of these fields to be essentially on top of each other; visibility dependant on previous choices. I can get to Menu 1 (select paper color) and then Menu 2 if they select white. But there's a problem with setting up a third menu in this series, if they select "color" from Menu 1, then I try to have a drop down for paper weight, all the fields except for Menu 1 are hidden. Playing with the script let me have them all visible, but again, I'm limited on space and can't really spread them out.


I know I'm missing one small command... somewhere.

Here is the script I'm working with:


Code:
function control_section_fields() {

    if (event.willCommit) return;

    // Get the value selected in the combo box
    var section = event.changeEx;

   // Hide all of the entry fields
    getField("sec").display = display.hidden;

    // Reset all of the entry fields
    resetForm(["sec"]);

    // Display the fields for the selected section
    getField("sec." + section).display = display.visible;

}
where the drop down fields are named "sec.a.dd" for example, and the Export value of different values are assigned as "a", "b", etc.

Sorry for the rambling. Any help will be greatly appreciated.

Last edited by fogharty; 09-11-2012 at 09:12 PM.. Reason: spacing
fogharty is offline   Reply With Quote
Old 09-11-2012, 10:00 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 453 Times in 451 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
maybe this is some thing with Acrobat X (which I know nothing about), but if you use display:none instead of visibility:hidden the hidden elements don't take up any space at all (but then display.hidden doesn't make much sense in javascript - I guess you will have to look at the documentation to see if you can use display.none)
xelawho is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:11 PM.


Advertisement
Log in to turn off these ads.