Using javascript to populate one menu based on the choice in another menu

I have several menus which are dynamically populated (with PHP and MYSQL). The information is category based. How do I dynamically populate the second menu based on the choice the user makes in the first menu (without having to submit and refresh the page-- i.e. I need to use javascript instead of the server-side PHP).
Example:
Main Categories: 1) Numbers     2) Letters
Sub Categories:        1                      a
                               2                      b 
                               3                      c
                              etc.                  etc.
the first menu contains the two main categories. I want the second list to be populated with only the sub categories of the main category the user chooses in the first menu (i.e. 1,2,3 etc. if he chose the main category 'Numbers' and a,b,c, etc. if he chose the main category 'Letters')
Is there an easy way to do this in Dreamweaver?
Thanks,
YWSW

How many items do you have in each dropdown? If it's a small number, you can download all of the options for the second dropdown and use client side javascript to filter based on the choice of the first dropdown. If the number is large, you'll need to use AJAX to dynamically pull the related items from the database.
Search the web for "dependent dropdown" or "cascading dropdown" for some technical details.

Similar Messages

  • Populate one cell based on the contents of another

    Greetings to all
    I am entering street addresses into numbers. In an effort to save time I would like the entry into column B to determine what is automatically entered into column C
    Example:
    If I enter Jones in column B, I want Street to automatically populate column C in the same row
    If I enter Smith in column B, I want Avenue to automatically populate column C in the same row.
    Thanks in advance for any help.
    AJ

    I assume that "Jones" is "Jones Street" and "Smith" is "Smith Avenue".
    You will need a lookup table with a column containing all of the road names you will be entering, and a second column listing the the matching road type (Street, Avenue, Boulevard, Place, etc.) for each name. Fill the formula shown in the illustration down to all the cells in column C of the Main table.
    I've used IFERROR to flag street names that are not found in the table. To omit the "no match" message and instead show an empty cell, change "no match" to "" in the formula.
    Regards,
    Barry

  • Display an exception on one keyfigure based on the value of another key fig

    Hello all,
    How to run a exception based on some condition i.e
    i want to highlight the sales(key figure) which r less than the  average sales..
    where sales and average sales r keyfigures...
    i also created a cal key fig which has has value 1 if sale > avg sale...
    i.e How do i display an exception on one keyfigure depending on the value of another keyfigure??
    plz reply its urgent...
    thnx in advance...

    Hello Ajay, did you got an answer for your problem? I'm interested...
    Thx Masen
    Edited by: Masen-Fuad Marei on Nov 25, 2009 6:26 PM

  • Changing content of one label, based on the content of another

    Hello all,
    I need some advice on how to go about doing something that should be simple.
    Basically, I have two labels, that will be used in a marquee animation. When label one gets changed, I want label two to mimic label one's content. Since there is no ContentChanged Event for labels, I have been relying on the SizeChanged event of label one
    to do the job.
    However, the issue arises when label one's content extends past that of its parent container, thus no longer firing SizeChanged.
    When label one's supposed length is equal to or greater than that of its container, is when I would start the marquee animation.
    Basically, I need a sure fire, reliable, 100% accurate way to update label two's content to match that of label one's despite its length.
    I have read the following: Label.Content Changed Event
    However this does not solve the issue, as the event fires for "all" custom label classes, due to the ContentProperty being declared Static/Shared.
    Thanks in advance!

    <UserControl x:Class="CustomControls.UserControls.ValidationUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d" Height="36" Width="120">
    <Grid x:Name="z">
    <TextBox x:Name="txtBase" Text="TextBox" Margin="0,0,0,13"/>
    <Label x:Name="lblStatus" Content="Status" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Bottom" FontSize="10" Foreground="#FFE12828" FontWeight="Bold">
    <Label.Effect>
    <DropShadowEffect BlurRadius="5" ShadowDepth="1"/>
    </Label.Effect>
    </Label>
    <Label x:FieldModifier="Friend" x:Name="lblMarquee" Content="{Binding ElementName=lblStatus, Path=Content}" HorizontalAlignment="Right" Margin="0,23,-29,0" FontSize="10" Foreground="#FFE12828" FontWeight="Bold" Background="Transparent" Height="13" VerticalAlignment="Top">
    <Label.Effect>
    <DropShadowEffect BlurRadius="5" ShadowDepth="1"/>
    </Label.Effect>
    </Label>
    </Grid>
    </UserControl>

  • How to modify F4 help of one parameter based on the value of another?

    Hi,
    My Query is as follows:
    I have 3 select-options / parameters on the selection screen.
    If I enter some value in the first parameter the values in the second parameter should reflect accordingly.
    For example: The 3 selection-screen parameters are:
    select-options: s_werks for pa0001-werks no intervals,
                          s_btrtl for pa0001-btrtl no intervals,
                          s_kostl for pa0001-kostl no intervals.
    On exceuting the report, say I do a F4 and select '1000' for the first parameter (s_werks).
    Now after selecting the value for the first parameter if I do a F4 on the second parameter (s_btrtl) then it should prompt me with a F4 help containing values only corresponding to '1000' entered in s_werks and not all the values maintainined for btrtl.
    I have tried AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BTRTL-LOW.
    And then used the FM F4IF_INT_TABLE_VALUE_REQUEST.
    But At Selection-Screen On Value Request the selection screen parameter s_werks does not show any value. It reflects the value only once it reaches Start-of-selection.
    Can anyone please guide me how to go about it?

    hi
    Please do it in this way..
    TABLES: pa0001.
    select-options: s_werks for pa0001-werks no intervals,
    s_btrtl for pa0001-btrtl no intervals,
    s_kostl for pa0001-kostl no intervals.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BTRTL-LOW.
      PERFORM sub_pop_btrtl .
    *&      Form  sub_pop_btrtl
          text
    -->  p1        text
    <--  p2        text
    form sub_pop_btrtl .
    DATA :  l_wa_dynp TYPE dynpread,
            l_i_dynp TYPE STANDARD TABLE OF dynpread,
            l_wa_temp LIKE LINE OF S_werks.
    REFRESH s_temp[].
      l_wa_dynp-fieldname = 'S_WERKS-LOW'.
      APPEND l_wa_dynp TO l_i_dynp.
    Get the screen values of template
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = sy-repid
          dynumb               = sy-dynnr
        TABLES
          dynpfields           = l_i_dynp
        EXCEPTIONS
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          OTHERS               = 11.
      IF sy-subrc <> 0.
    Do Nothing
      ENDIF.
    Put the screen value in the select-options
      READ TABLE l_i_dynp INTO l_wa_dynp INDEX 1.
      l_wa_temp-sign = 'I'.
      l_wa_temp-option = 'EQ'.
      l_wa_temp-low = l_wa_dynp-fieldvalue.
    Now you use l_wa_temp as plant field
    endform.                    " sub_pop_btrtl

  • How do I make one menu listen to the selection of another menu?

    Suppose here I've got 2 menus, Menu_A and Menu_B.
    The items of Menu_A are A1, A2, A3.... and the items of Menu_B should be refreshed upon the selection of each Menu_A item.
    For instance, if the user choose A1 in Menu_A, the items of Menu_B are updated as B1..... and if choosing A2 in Menu_A, Menu_B's items are updated as B2....
    So anyway to handle this?

    Such behavior is better suited to ChoiceBox than Menu... Users expect menus to be relatively stable.

  • Conditionally Formatting One Column Based On The Value of Another Column

    I have the following requirement:
    I have 2 columns in a report showing Actual Sales & Budget Sales each year. I am using a bar chart to show the different values for these 2 columns.
    I need to conditionally format the column "Actual Sales" so that if it is less than the "Budget Sales" it will appear in red, and green if "Actual Sales" is greater than "Budget Sales." So in a nutshell,
    CASE WHEN "Actual Sales" < "Budget Sales" THEN
    RED
    ELSE
    GREEN
    END
    Thoughts anyone?

    CASE WHEN (COL1 - COL2) < 0 then Red else Green end
    regards
    John
    http://obiee101.blogspot.com

  • How to calc sum of one column, based on the condition of another column?

    I would like to create a formula that adds up the total cost from column F for each specified service in column D. For example, the result for PM (project management) would be $495. Any ideas?

    I think you could use this formula, using your cell references:
    =SUMIF(D4:D21,"=CM",F4:F21)
    Then, change the "=CM' to "=PM", etc. for each service.
    Like JaxJason, I can't test this in Numbers right now, but it works in Excel, and the functions are identical.
    SUMIF(test-range, "condition", [sum-range]):
    * test-range: A reference to the range of cells containing values to test. Must be the same dimensions as sum-range.
    * "condition": Any comparison statement that results in a logical TRUE or FALSE value.
    * sum-range: Optional; a reference to the range of cells containing the numbers to be added. Must have the same dimensions as test-range. If omitted, test-range is used.
    I hope this helps.
    - Michael
    Message was edited by: Apple fan Michael

  • 'File in Use' message is received when one user is in the report and another user tries to open the Excel template

    ‘File in Use’ message is received when one user is in the report and another user tried to open the excel template. how to make excel template shared for multiple users so the users don’t see the ‘File in Use’ message?

    Hi Febin,
    In addition to others’ replies, we can create a shared workbook and place it on a network location where several people can
    edit the contents simultaneously. For example, if the people in your work group each handle several projects and need to know the status of each other's projects, the group can use a shared workbook to track the status of the projects. All persons involved
    can then enter the information for their projects in the same workbook.
    Regarding how to do this,
     the following article can be referred to reference.
    Use a shared workbook to collaborate
    http://office.microsoft.com/en-in/excel-help/use-a-shared-workbook-to-collaborate-HP010096833.aspx
    Best regards,
    Frank Shen

  • Can a single datasource be used by more than one Application running on the

    Can a single datasource be used by more than one Application running on the system?

    What, in this context, do you mean by "datasource"?

  • Validating an attribute based on the value of another while inserting

    Hi guys
    I need to validate an attribute based on the value of another attribute.
    Example:
    inside some entity I have the following validation function
    public boolean validateAtt1(Number data){
         if (this.getAtt2() < some vlaue)
              return false;
         return true;
    this function works fine when I'm updating a record, but when I'm inserting a new record the this.getAtt2 return null, now I don't want to override the validateEntity function I want to override the validate function for att1; so in other words is there a way to reach att2 in the validation function of att1 when I'm inserting a new record, because the this.getAtt2() returns null if I'm inserting a new record.

    Using attribute-level setter methods won't work because when the value of a particular attribute is being set, the values of the other attributes might not yet have been set. This explains for example why it does not work when inserting a new record. You therefore have to validate at entity level.
    Rather than coding on the validateEntity() method you use a built-in Validator or Method Validator. When recording validators like this, you can provide a separate message for each business rule. If you also have the bundled exception mode enables (which will be the case by default for web applications), then multiple messages can be shown at the same time.
    If you have one business rule involving two different attributes, for example a and b, and you must provide different messages based on if a is causing the violation or b, you can do it like this:
    - implement one method doing the validation and that will indicate which attribute is causing the violation
    - implement two different method validators (with two different messages) that call the method doing the actual validation and return false based on the attribute causing the violation
    For more information about implementing business rules in ADF BC, you might have a look at this white paper:
    http://www.oracle.com/technology/products/jdev/collateral/papers/10131/businessrulesinadfbctechnicalwp.pdf
    Jan Kettenis

  • OBIEE Report - filter based on the result from another analysis

    Hi,
    I am using OBIEE 11g,
    I am trying to use a filter which is based on the result from another analysis. I have an analysis A which is as table 1, and I want to filter the respective columns of analysis B (Table B) based on analysis A to remove the duplicates for march 01, 02, and 07 , but it is not working properly. I took a max of start and end time when I created analysis A. Please let me know if I did anything wrong. thanks.
    Table 1
    Employee Number
    Date
    IN
    Out
    Start Time
    End Time
    xxxxxxx
    2015-02-26
    9:00
    13:00
    00:00:00
    00:00:00
    2015-02-27
    12:00
    18:00
    00:00:00
    00:00:00
    2015-02-28
    8:00
    14:00
    00:00:00
    00:00:00
    2015-03-01
    14:00
    20:00
    14:00:00
    20:00:00
    2015-03-02
    16:00
    20:00
    16:00:00
    20:00:00
    2015-03-07
    14:06
    20:02
    14:00:00
    20:00:00
    2015-03-11
    16:00
    20:00
    16:00:00
    20:00:00
    2015-03-14
    8:00
    14:00
    00:00:00
    00:00:00
    2015-03-25
    14:00
    20:00
    16:00:00
    20:00:00
    Table 2
    Employee Number
    Date
    IN
    Out
    Start Time
    End Time
    Hours
    xxxxxxx
    2015-02-26
    9:00
    13:00
    00:00:00
    00:00:00
    -3
    2015-02-27
    12:00
    18:00
    00:00:00
    00:00:00
    6
    2015-02-28
    8:00
    14:00
    00:00:00
    00:00:00
    6
    2015-03-01
    14:00
    20:00
    00:00:00
    00:00:00
    6
    14:00:00
    20:00:00
    6
    2015-03-02
    16:00
    20:00
    00:00:00
    00:00:00
    4
    16:00:00
    20:00:00
    4
    2015-03-07
    14:06
    20:02
    00:00:00
    00:00:00
    6
    14:00:00
    20:00:00
    6
    2015-03-11
    16:00
    20:00
    16:00:00
    20:00:00
    4
    2015-03-14
    8:00
    14:00
    00:00:00
    00:00:00
    6
    2015-03-25
    14:00
    20:00
    16:00:00
    20:00:00
    4

    Why avg here?
    What columns you want to show in the report?
    for a employee for given date if he have 2 rows then you may sum up hours right?
    Employee Number
    Date
    IN
    Out
    Start Time
    End Time
    Hours

  • How to Visible/Hide an Item based on the value of another Item

    Hi
    I need to visible and hide a textitem based on the value of another item.This form has 3 blocks, and the both item is in the first Master Block.
    My code is:
    if :RECORDTYPE=7 then
         Set_Item_Property('BLOCK.ITEM',VISIBLE,PROPERTY_TRUE);
         Set_Item_Property('BLOCK.ITEM',ENABLED,PROPERTY_TRUE);
    ELSE
         Set_Item_Property('BLOCK.ITEM',VISIBLE,PROPERTY_FALSE);
    Set_Item_Property('BLOCK.ITEM',ENABLED,PROPERTY_FALSE);
    :BLOCK.ITEM:=NULL;
    end if;     
    I wrote the code in the Validate Trigger, but not working when moving Next Record & Previous Record
    Thanks in advance
    Rizly

    Read the 'Propagation of Property Changes' section towards the end of the page for Set_Item_Property in the online help. I'm not sure what you mean by locking automatically but perhaps it's because of this.
    You should also ensure the item you're setting to invisible is not the current item (check :system.cursor_item and go to a different item if necessary).

  • How do I use Javascript to populate a text field based on a selection from a drop down box?

    Greetings,
    I have virtually no experience with JavaScript and I am trying to figure out how to add some basic automation features to an Adobe form.  I have a drop down box called "Hospital_Name" that will contain approximately 7 possible selections.  When the user makes a selection, I would like to have the text field (called "Hospital_Address") below the drop down box populate with the corresponding address for the selection.  I have the "Hospital_Address" text field configured for multiple lines and would like the address to have a line break between the street address and the city/state/zip.
    For example, if the user selected "Hospital 1", the text field would display:
    123 Main St
    Anytown, CA 12345
    Any help or examples you can provide would be greatly appreciated.

    You have the element names within the object within brackets.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    // some debugging code to see location names;
    console.show();console.clear():
    for(I in Location) {
    console.println(I);
    // end debugging code;
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;
    This is not a beginners task but requires a fair amount of knowledge about the structure of objects, defining strings, and structure of arrays.
    Are you sure you have all the field names correctly spelled and capitalized?
    Do you get any error in the JavaScript console?
    Just trying the line that defines the "Location", I get the following error:
    SyntaxError: invalid property id
    1:Console:Exec
    undefined
    All the form field in a PDF are processed by using JavaScript and any error in any script will stop JavaScript processing.
    It might help to have a link to the problem form.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;

  • Populate one text field on a form based on the value in another

    I am new to APEX and building my first application.
    When a user enters a value in one field, I would like to run a SQL command and then display a value in another field based on the value in the first field. For instance, if a user enters a part number in one field, when they tab off of the field, I would like to display the name of the part in the part name field.
    Thanks

    Thanks. That put me on the right track. I used that link to find the link http://htmldb.oracle.com/pls/otn/f?p=11933:11:2890374750690437 and then using the two was able to put together a solution.
    I am down to one last issue. I am able to return the name back from the process and display it with an alert statement. Unfortunately, I am unable to display the value on the form.
    I am doing the following.
    <script language="JavaScript1.1" type="text/javascript">
    function f_getCustomerName(id)
    var v_id = id;
    var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=getCustomerName',$v('pFlowStepId'));
    get.addParam('x01',$v('P2_CUSTOMER_ID'));
    gReturn = get.get();
    get = null;
    gReturn = (!gReturn)?'null':gReturn;
    /* The below do not work
    $s('P2_CUSTOMER_NAME',gReturn);
    document.getElementById('P2_CUSTOMER_NAME').value = gReturn;
    document.getElementById('P2_CUSTOMER_NAME').value = 'TEST';
    alert(document.getElementById('P2_CUSTOMER_NAME').value );
    alert(gReturn);
    //-->
    </script>
    Process: getCustomerName
    declare
    l_customer_id customer.customer_id%type;
    l_customer_name customer.customer_name%type;
    begin
    l_customer_id := to_number(wwv_flow.g_x01);
    select customer_name
    into l_customer_name
    from customer
    where customer_id = l_customer_id;
    htp.p(l_customer_name);
    end;

Maybe you are looking for