Show/Hide fields based on choices in drop down menu

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:
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.

also, if "==" could be roughly translated to "is", "!=" would mean "is not".
JavaScript is Case sensitive so make sure you did not name your field STATE#1 instead.  It's a pretty common error.  Try not to use special characters when naming fields.  Stick to standards.  I personnally always name fields with capital letters and numbers using identation like
MYFORM.PLACE.NUMBER
MYFORM.PLACE.ADDRESS
MYFORM.SEX.MALE
MYFORM.SEX.FEMALE
This is really useful if you have lots of fields related to one another.  You can then apply methods to entire groups of fields in one simple line of code.
For example this.getField("MYFORM").display = display.hidden would hide all four fields.  It works kind of the same way as folders unside your computer.
Finally, "#" is generally used as widget identification.  I think this is what happened.  If you copy a field, it retains the same name and some of its charateristics but acrobat will assign them a number called widget.  The original field State will get the identification State#0 in the right pane as it is 0-based.  The copie will be identified State#1.  You must understand that the name of the field is still "State".  Some methods (actions you can code) let you determine the widget number for targetting a specific field from those you copied.  It is not the case here.  So for disambiguation, you should name your fields different name like STATE1 and STATE2, or STATE.1 and STATE.2 if you plan to use what I wrote about earlier.

Similar Messages

  • Populate a table field from selection made from drop down menu

    Hello all,
    I'm having a bit of head scratching problem that i just can't get my head around. I'm using Dreamweaver CS4
    and phpmyadmin for my site.
    I have a form that inputs a record into a table in my database.
    The form is a user picking a fantasy sports team. A user selects a player from a drop down menu.
    The players name is got from a recordset that accesses the player database, with the values coming
    from the id field and the values from the name, so a user selects a player by there name and not
    there unique id value. The code for this is as follows:
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">GoalKeeper:</td>
    <td><select name="gkid_team">
    <?php
    do {
    ?>
    <option value="<?php echo $row_rs_pt_gk['gkid_gk']?>" ><?php echo $row_rs_pt_gk['gkname_gk']?></option>
    <?php
    } while ($row_rs_pt_gk = mysql_fetch_assoc($rs_pt_gk));
    ?>
    </select></td>
    What i'm trying to achieve is that when a user selects a player from the drop down menu, their price is displayed in the table cell next to the menu. The value is held in the same table of database as the names and id values. I need to do it so the page doesn't need to be refreshed so i assume i need to use some sort of javascript, php and/or maybe ajax. However with java and ajax i have very little or no experience so i'm not really sure what i'm doing. I've been on numerous forums, looked in text books and have been searching the net for hours but i can't seem to solve this problem.
    Any help or advice would really be appreciated as i just can't seem to get my head around it,
    Thanks,
    pb1uk

    can this be done??? thanks in advance annieYes.
    One way of doing it is submitting the form on change of the selected value and fetch back the query results. Have a servlet invoke the method and set the results in the request.
    Another way (not recommended) is to fetch the results corresponding to all the values in the dropdown and have it in the session. The latter solution would obviously be slow.

  • Show / hide field based on text in another field

    Hi,
    I'm trying to make one of my fields reactive to what is the text generated in another field.
    At the moment I have this under calculate using custom javascript:
    var Mask = this.getField("Course").value;
    if(Mask == 'Swimming') this.getField("Code").display = display.visible;
    else this.getField("Code").display = display.hidden;
    Whereas Course is the field that is changing and Code is the one that will show/hide based on content of Course.
    Any help?

    Hi Everyone,
    After doing trials with simple calculations it still wasn't working and so I've figured out what the problem is - the document was being exported but with the data being pre-populated from an SQL database in which during the export it all happens at once, not a chain effect so when the export happens it was filling "Code" before "Course" had any info in it...
    The fix was basically having to create a different field in the SQL source itself for an independent field on the pdf form.

  • APEX 4.1 show hide fields based on value of checkbox/radio

    I am trying to successfully hide and show fields based on the value of a clicked checkbox.  I am using a dynamic action, but it isn't working. 
    I followed the sample at Does Oracle Apex 4 enable the following AJAX features? (ie without the dev writing the Javascript) - Stack Overflow
    I even tried a radio button, but it didn't work.  I cannot uncheck the radio button.  What am I doing wrong?  Thank you for any help you can provide.

    Hi,
         create a dynamic action for page load to hide the item which you wanna hide
         now create another dynamic action
         event : Click
         Selection Type : Items
         Items : P1_Check_box(name of the check box item)
         condition : equal to
         value : return value of the check box item (if you click the check box and the return value is 1 then just add 1)
         in true actions
         Action : Show
        Selection Type : Items
         Items : P1_Text_field(name of the field)
         uncheck fire on page load
         create exact opposite false action, that's it.
    Regards,
    Mohan.

  • Show/Hide Fields Based on Dropdown

    Hi,
    I am attempting to show/hide subforms with a dropdown selection. I've found a lot of information on the subject, and have ended up with this as my script:
    form1.Page1.Division::exit - (JavaScript, client)
    switch (Page1.Division.rawValue)
       case "1":
       SubformZZI.presence = "visible";
       SubformZZR.presence = "hidden";  
          break;
       case "2":
       SubformZZI.presence = "hidden";
       SubformZZR.presence = "visible";      
          break;
    However, it is not doing anything when a selection is made in the dropdown box. I have the "SubformZZI" initially set as "Visible" and the "SubformZZR" initially set as "Hidden".
    Any suggestions?
    Regards,
    ZeroZone

    You have wrongly referenced the fields in your code.
    Copy and paste the below code in the click event of the Submit button. It should work as expected.
    The code thathas error is commented..
    // First check if there are null values, then construct email using script
    var vEmail = "";
    var vSubject = "";
    var vBody = "Attached to this email is a Field Service Issue - Parts Order Form for Job #" + Page1.JobNumber.rawValue + ".";
    var vName = "";
    var vCC =  "[email protected]" + "," + Page1.RSM.rawValue + "," + Page1.IssueLeaderEmail.rawValue; 
    var vFormat = "PDF";
    var errorMessage = "At least one required field was empty. Please fill in the required fields (highlighted) before continuing.";
    // Check required fields and build error message
    if (Page1.IssueLeaderEmail.rawValue == null)
    errorMessage = errorMessage;
    else
    vSubject = "Field Service Issue - Parts Order Form for Job #" + Page1.JobNumber.rawValue;
    // Check Division field
    if (Page1.Division.rawValue == "Case Division")
         //vEmail = Page1.SendFormToZZI.rawValue;
         vEmail = Page1.SubformZZI.SendFormToZZI.rawValue;
         //vCC = Page1.SendCopyToZZI.rawValue + "," + Page1.CSTZZI.rawValue;
         vCC = Page1.SubformZZI.SendCopyToZZI.rawValue + "," + Page1.SubformZZI.CSTZZI.rawValue;
    else
         //vEmail = Page1.SendFormToZZR.rawValue;
         vEmail = Page1.SubformZZR.SendFormToZZR.rawValue;
         //vCC = Page1.SendCopyToZZR.rawValue + "," + Page1.CSTZZR.rawValue;
         vCC = Page1.SubformZZR.SendCopyToZZR.rawValue + "," + Page1.SubformZZR.CSTZZR.rawValue;
    // If fields required for script are null, warn user and do not initiate email
    if (Page1.IssueLeaderEmail.rawValue == null)
    xfa.host.messageBox(errorMessage, "Sending an email", 0, 0); // Send out a custom error message if any of these fields are null
    else
    // Everything is OK, send email
    event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody + "&cc=" + vCC,cSubmitAs:"PDF",cCharset:"utf-8"});
    Thanks
    Srini

  • I would like to create a web that gives users choices from drop down menu and it then calculates the results back to them and copy to me

    Hello I am a wedding planner and have decided to create new website.   I would like to have the user make choices of different items and have it calculate so that they can print it off.  Like an estimate of what costs would be to plan a wedding .  I will be giving them different selections to choose from  in drop down or radio selections .
    I was thinking much like a shopping cart but that seems too involved is there a simpler way.   Thank you for any help.

    Just based on your question I can tell that you're probably not experienced enough to develop something like a shopping cart. Hiring a web developer is the way to go, as previously said.

  • Marker and line styles as a choice in drop down menu

    Is it possible to create a drop down choice menu(Choice xyz = new Choice(); ) in java AWT which has line styles or marker styles (no text)( basically these things are required to edit the graph) as choice options?

    /*  <applet code="ChoiceTest" width="400" height="400"></applet>
    *  use: >appletviewer ChoiceTest.java
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class ChoiceTest extends Applet
        ChoiceGraphicsPanel graphicsPanel;
        Choice choice;
        Checkbox rows, cols;
        String[] colorNames;
        public void init()
            graphicsPanel = new ChoiceGraphicsPanel();
            setLayout(new BorderLayout());
            add(getChoicePanel(), "North");
            add(graphicsPanel);
        private Panel getChoicePanel()
            rows = new Checkbox("rows", true);
            cols = new Checkbox("cols", false);
            colorNames = new String[] {
                "red", "green", "blue", "orange"
            choice = new Choice();
            for(int j = 0; j < colorNames.length; j++)
                choice.add(colorNames[j]);
            choice.addItemListener(new ChoiceListener());
            Panel panel = new Panel();
            ((FlowLayout)panel.getLayout()).setHgap(35);
            panel.add(choice);
            panel.add(rows);
            panel.add(cols);
            return panel;
        private class ChoiceListener implements ItemListener
            Color[] colors = {
                Color.red, Color.green.darker(), Color.blue, Color.orange
            public void itemStateChanged(ItemEvent e)
                if(e.getStateChange() == ItemEvent.SELECTED)
                    int index = choice.getSelectedIndex();
                    Color color = colors[index];
                    if(rows.getState())
                        graphicsPanel.setRowColor(color);
                    if(cols.getState())
                        graphicsPanel.setColColor(color);
        public static void main(String[] args)
            Applet applet = new ChoiceTest();
            final Frame f = new Frame();
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    f.dispose();
                    System.exit(0);
            f.add(applet);
            f.setSize(400,400);
            f.setLocation(200,200);
            applet.init();
            f.setVisible(true);
    class ChoiceGraphicsPanel extends Panel
        int rows, cols;
        Color rowColor, colColor;
        public ChoiceGraphicsPanel()
            rows = 4;
            cols = 4;
            rowColor = Color.red;
            colColor = Color.blue;
        public void paint(Graphics g)
            super.paint(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            int xInc = w/cols;
            int yInc = h/rows;
            int y = 0;
            g2.setPaint(rowColor);
            for(int j = 0; j < rows; j++)
                g2.drawLine(0, y, w, y);
                y += yInc;
            int x = xInc;
            g2.setPaint(colColor);
            for(int j = 0; j < cols - 1; j++)
                g2.drawLine(x, 0, x, h);
                x += xInc;
        public void setRowColor(Color color)
            rowColor = color;
            repaint();
        public void setColColor(Color color)
            colColor = color;
            repaint();
    }

  • Transferred bookmarks from Chrome not showing on bookmarks toobar - only on nested drop down menu. How can I get them on the toolbar?

    Was using Chrome - now using Firefox 8.0.1
    I copied and imported bookmarks from Chrome, but they only show up on the 2nd tier drop-down "Bookmarks" tab. How can I get them to show up on the Book marks Toolbar (without re-bookmarking them all)? Thank you.

    Re-arrange those bookmarks so they are in the Bookmarks Toolbar folder.
    http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox

  • Copy text fields and drop down menu fields

    Hi,
    Using LiveCycle Designer ES, I am making a simple form with some text fields and along with some drop-down menu fields.  With the resulting pdf, I need for one to be able to select the appropriate selection in the drop-down menus.  Then using cntl-a to select everything and then cntl-v to copy it into a text document.  This approach will only copy the text fields and not what is showing in the drop-down menu field.  Is there any way to solve this problem?  The end users computer has limited tools and software cannot be installed on it.
    Thank you for considering this issue and any help you may provide,
    ja

    Hi,
    I don't really know if the text field can be selected using Ctl+a, but if that is possible how about adding extra text field that is linked to pulldown menu?
    If the usage of the PDF is only for copying, then I would make a formcalc or javascript to combine all the text into one text field so that user only need to copy paste one field.

  • Drop down menu in selection screen field

    Hi all,
    my requirement is
    In selection-screen  in one field I have to get drop down menu for 2 values.
    1.     Pvalue.
    2.     Hvalue.
    By default it should pickup Pvalue. 
    can any one guide me how to get the logic for that
    Regards
    cnu

    Just paste this code: u will get idea..
    report YH642_DROP_DOWN_BOX.
    TYPE-POOLS vrm.
    **"Table declarations...................................................
    *TABLES sscrfields.
    *"Table declarations...................................................
    PARAMETERS:
    p_connid(11) AS LISTBOX
    VISIBLE LENGTH 20 default 'FOREX-ANANTH'.
    p_value TYPE i MODIF ID QWR.
    *" Data declarations...................................................
    Work variables *
    DATA:
    w_char(20) TYPE c,
    w_flag TYPE i.
    INITIALIZATION. EVENT *
    INITIALIZATION.
    Internal table to hold delivery header data *
    DATA:
    t_table TYPE
    STANDARD TABLE
    OF vrm_value,
    vrm_values1 LIKE LINE OF t_table.
    vrm_values1-key = 'a'.
    vrm_values1-text = 'sap'.
    APPEND vrm_values1 TO t_table.
    vrm_values1-key = '2'.
    vrm_values1-text = 'testing'.
    APPEND vrm_values1 TO t_table.
    vrm_values1-key = '2'.
    vrm_values1-text = 'java'.
    APPEND vrm_values1 TO t_table.
    vrm_values1-key = '4'.
    vrm_values1-text = '.net'.
    APPEND vrm_values1 TO t_table.
    vrm_values1-key = '5'.
    vrm_values1-text = 'vc++'.
    APPEND vrm_values1 TO t_table.
    vrm_values1-key = 'che'.
    vrm_values1-text = 'chetta-ram'.
    APPEND vrm_values1 TO t_table.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
    id = 'p_connid'
    values = t_table
    EXCEPTIONS
    ID_ILLEGAL_NAME = 1
    OTHERS = 2
    reward points if helpful,
    regards,
    seshu.

  • HT1918 Trying to make make account changes to my itunes account.  Receive error message regarding province "enter at most 3 letters" when the only option I have is to select from a drop down menu.  Cannot make changes to my account.  How do I get this fix

    As you can tell, this is my first post
    I am attempting to make changes to my itunes account, but when I hit done, an error message "enter at most 3 letters or numbers for province" appears.  I have not attempted to make any modificaitons to this field.  The only options I have for data in this field are picked from a drop down menu.  I have no idea why this msg is appearing.  Any ideas on why it is showing up?  Thanks.

    There seems to be at least one package that can't be located. See the message below from you log file
    Requesting locations synchronously for content SDC00003.2
    with priority Medium    ContentAccess    4/3/2015 1:30:51 PM    2644 (0x0A54)
    The number of discovered DPs(including Branch DP and Multicast) is 0    ContentAccess    4/3/2015 1:30:51 PM    2644 (0x0A54)
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • In Itunes 12 is there a way to view search results in the playlist view rather than the drop down menu?

    When searching for a song title, an artist etc in Itunes 12 it shows the results via a tiny consolidated drop down menu, however in previous version of Itunes search results would be displayed in the main playlist view. I seriously dislike the search drop down view because A) it only shows limited results B) It shows artwork C) It is confusing when trying to search your playlist when you are trying to organize your library.
    If anyone knows a way to change the search view preference please let me know how or advise me on how to suggest to Apple that they change it back or give people the option to choose which search result view they would like to use.
    Thanks.

    If you disable the Search Entire Library option (available in the dropdown to the left of the search box) iTunes 12 will not show the search results in a dropdown but will immediately go to a filtered version of your current view.  With the Search Entire Library option enabled, you can still get to this filtered view by clicking on the first entry in the drop down, which will say "Show <search string> in Library" or "Show <search string> in <playlist>" depending on where you start the search from.
    There are some inconsistencies in the search behavior, most notably that where you have the Search Entire Library option enabled and search within a playlist the dropdown will show all matches in you complete library (whether in your playlist or not), whereas the first entry in the dropdown just takes you to the filtered playlist view.
    You can use https://www.apple.com/feedback/itunesapp.html to provide input to developers about bugs, enhancement requests, etc.

  • Show/hide fields when selecting an option from a drop-down menu.

    Hello Gurus!
    I have a question about creating a Java Script withing Acrobat pro.  This is what i would like to do: I created a drop-down menu with several selection entries.  Upon the customer making one of the selection entries, i would like for the correct fields that i created to become visible and all other fields to hide.  Is this even possible to do?  The reasoning behind this is because we have a form that customers have to generate in order to request access to certain financial accounts; we have over 20 different types of accounts and for each instance the customer has to fill out the same form.  By creating a drop down menu, i can use the same form by just changing the drop-down selection and clicking on the designated fields for that selection.  At this time i have over 20 different forms that poing to 20 different account requests and i would hate to send the form 20 different times to one person.  The reason i can not add all fields desired for all accounts is due to the fact that the form would be filled with hundreds of checkmarks and instructions thus making the process too tideous for the customer.  Hope you guys can help out.
    ~Vader

    The good news is, it can be done (and it has been done).
    There are a few things to be aware of, however.
    The most important is that the form must be planned well, which means that you must think carefully about your logic and even more so about your field naming (hierarchical field names are your friend). One fundamental issue, you have to be aware of, is that this form no longer will be a "standard form". The consequence of this is that you may have to be aware that you might get into trouble when you have to prove that your user filled out that particular standard form (talk to your compliance and forms management people about that).
    You also may have to decide whether the form should be usable in Reader. And, if so, how much you want to spend on the right to do so. You will see below why…
    There are actually two approaches for dynamically showing/hiding parts of a form. If your form can be separated between a fixed first page (where you also have the account type selection), and a variable part (depending on the selection), you could use Templates, which you spawn according to the selection, and delete pages when you change the selection. This approach is very easy to implement, but requires Reader Extensions Server to allow it to work in Reader; Acrobat Pro's extended rights are not sufficient for that.
    The other approach is showing/hiding fields. If you did your homework well, it would be very easy to first hide all subsequent fields, and then show the ones you need in two lines of code. This approach does not require extended rights for Reader at all, as long as your forms will always have the same number of pages, for each of your account types. This approach also works for the cases where the differences between the individual forms are very small. It does also work for showing/hiding bigger chunks of the form. In that case, you might create the "background" separately, and then put it as an icon into a button field which you will show/hide together with the carefully placed on top of it active fill-out fields.
    There is a third possibility, which Adobe Propaganda probably would suggest, and that woudl be subforms in LiveCycle Designer. The consequence is, however, that you won't have PDF forms, but proprietary XFA forms instead. And you may have more developing and maintenance work than with the other approaches.
    Back to your original question: you could use a Keystroke script evaluating event.changeEx of the combo box field. Depending on that, you would run your action to set up the according form part. The other way to do it would be evaluating event.value in the onBlur event. The latter would have the advantage that the selection has been made, and you get a bit more time to set up the form (this may in fact be an issue, particularly with Acrobat 9 and 10, which may take their time to show/hide fields).
    Another possibility instead of a drop down (combo box field) would be a popup, where you would have a button to press, and the list of selections pops up. This second method uses app.popUpMenuEx().
    Hope this can help.
    Max Wyss.

  • Determine number in a field based on word-choice in a drop-down menu

    I'm trying to insert a number in a field based on a word I've chosen in a drop-down menu.
    Example:
    I have a drop-down menu named "Fruits". In that menu is "Orange", "Apple" and "Banana".
    I have a different field called "Price". If the user selects "Orange" in the "Fruits" drop-down, the value of "Price" is 10. If the user selects "Apple" the value of "Price" is 15. If the user selects "Banana" the value of "Price" is 20.
    Been working with this for awhile, and feel like Im very close, but can't get it to work. If someone could help me I'd be grateful.
    Thanks,
    T.

    Thanks to both of you. I realize this is more complex than I thought, and that I didn't state my challenge correctly. Let me try again:
    I have a number of textual items in a dropdown, let's say "Apples", "Bananas" and "Cherries".
    I have an array of form fields, with different properites expressed as a numeric value, say: "Size", "Weight", and "Cost".
    Each of the items in the dropdown has a value for each of the fields.
    So when I select an item from the drop-down I want to populate the entire array from the values associated with the items in the drop down. Different items will fill the array of values (I actually have 28 properties in the array and about 7 items in the drop-down). The items will always have a value for all the properties in the array, but I want the user to be able to override all entries. So enter custom text in the drop-down, which would provide blank fields in the array, which could also be overwritten by the user.
    Hope that makes sense, and I apologize for my earlier attempt at describing this. It's hard enough to do in plain English, there's no way I can make this happen in Javascript, LOL!
    Thanks in advance for your patience and help.
    T.

  • Show/hide field options are grayed out

    If a drop down value is 1, I want to show field #1. If the drop down value is 2, I want to show fields #1 & 2. If the value is 3, I want to show fields # 1 2 & 3, etc. This appears not to be possible; a show hide rule is already created for value 1 and appears unavailable for a new rule for value 2. Any ideas for a workaround?

    Yes you can do this using the hide show logic. In the case you describe you want to use the if any rule rather than the if all rule. For drop down item one the logic is if any (1, 2 or 3) are selected show item one. For item two the logic is if (2 or 3) are selected show item 2.
    Andrew

Maybe you are looking for

  • Split transfer order on the basis of Storage Unit type(SUT)

    Hi, I got one problem and want the solution for that immediately.the problem is as follows:- The transfer Order needs to be split by quantity according to the quantity per Storage Unit Type. I have to do this making chages in the SAP standard user Ex

  • Itunes dropout due to TimeMachine

    I have been having some issues with TimeMachine and iTunes on my MBP - i am pretty sure this is not an Airtunes issue.. but sometimes when TimeMachine runs itunes stops playing for a few seconds.. if i turn TM off.. this does not happen.. i am moving

  • How to have Having clause in Group by

    Hi All, While using aggregated function (max,min etc) on columns, the SQL generated automatically has the non aggregated columns in the group by clause. How to specify the Having condition ? select a , max(b) from t group by a having <condition> TIA.

  • "player.play.it is requesting permission to store information on your computer."

    I believe this may be a virus. At the top of the messege it says Adobe flash player settings. Under that it says Local Storage. Under, it says requested: up to 1MB, currently used 100KB. Then it has 2 boxes to check either Allow or Deny. This pops up

  • How do I convert a keynote to flash and keep the video file

    I am trying to convert a keynote presentation into flash, but when I do I lose the videos. How do I stop this from happening? Thanks, Jeremy