Dynamic drop down list  with dynamic sql

Hi all,
I am facing a problem here..Please see if any one can help.
I jave a JSP page which has two drop down list boxes.
One list box is populated from the databse.
ListBox1:
values: kishan
maha
tony
assuming all those were populated from database.
ListBox2:
values: Chennai
Bangalore
Hyderabad
should come if "kishan" is selected from the first listbox.
if "maha" is selected then
Values: Delhi
Goa
Mumbai
should be populated from the databse using the where condition
got by the first selection.
Both these boxes are in same page and i do not want to transfer
this to another page..staying in the same how to accomplish this.
An onChange function of the selection list on listBox1 can be
written which gives me what value is selected. This i can get in
Java script. But how to give this value to a jsp variable which
queries the database using the selected value.
Is there any other logic i can use.
remember there is no request that is passed. both are in same page and on selection it should stay in same page populating the
second one dynamically.Bcoz what i have said is the operation in one row.. the same should happed for 5 rows in a form so.. pls send me code if possible or links related to this problem
please help.

You can use Ajax ;-) or you do a server roundtrip (aka postback) i.e. the onchange event of ListBox1 submits the form and the server returns the same page with the updated ListBox2

Similar Messages

  • Dynamic Drop-Down list in a table row or subform

    Hi,
    I need to display multiple drop-down list elements dynamically. Each of these DDLs will have different values.
    For example:
    The table will have 2 columns (Student Name text field and Courses drop-down)
    Row 1: Student 1 & Courses of Student1 in DDL
    Row 2: Student 2 & Courses of Student2 in DDL
    When I execute my app, both the drop-downs (i.e. for both the students) are displaying all the courses of all the students. I tried a lot with binding options..
    $record.Students[].Courses[]
    is refering to all elements of the node. If I use the index 0 for Students node, I am getting 1st element rows.. if I use 1, I am getting 2nd element rows,,,
    But How can I set the binding so that Row 1 has only Student 1 courses and Row 2 has Student 2 courses?
    IS THERE A WAY TO DYNAMICALLY SET THE BINDING USING JAVASCRIPT?
    I tried with tables, subforms.. it is not working. It is working fine in plain web dynpro table but not in an interactive form. I am using NW 2004s SP11, Web Dynpro Java. LiveCycle Designer 7.1, Adobe Reader 7.09.
    There are some other posts talking about similar issue.. I tried the solutions mentioned there as well, but nothing worked.
    I would really appreciate if any one can provide a solution or pointer to my problem.
    Thanks
    Ram

    Hey. Uh, this probably isn't the answer you were looking for, but it sounds like you've got a problem with your database design there. Generally speaking, your tables shouldn't have multi-valued fields, in the relational model anyway (sql). Instead, you should look at adding a separate table like EMPLOYEE_HOBBIES. Then you have a foreign key using the employees primary key as the foreign key in the employee_hobbies table, see what I mean? I might have misunderstood your explanation though, I'm not sure.
    Alternatively, you could just have hobbies as a big freeform varchar field, and don't bother to make people separate their hobbies into different fields (you'd have to abandon the drop-down listbox idea in this case). If there's no really important reason to make the distinction, then it's probably easier just to not do it.

  • Dynamic Drop-down list - selected value can't be cleared ...

    1. check out the following code of a dynamic drop down list using cursor :-
    DECLARE
         -- DROP-DOWN LIST OF ALL DEPARTMENTS
         TEMPNUMBER NUMBER(2) := 2 ;
    -- Because we've to initialize the list
    -- at least with 1 item.
    CURSOR C_DEPT IS
         SELECT DEPT_ID FROM DEPARTMENT;
    BEGIN
         ABORT_QUERY ;
         CLEAR_LIST('DEPTLIST');
         FOR TEMP IN C_DEPT LOOP
         ADD_LIST_ELEMENT( 'DEPTLIST', TEMPNUMBER, TEMP.DEPT_ID, TEMP.DEPT_ID );
         :SRBLOCK.LST := TEMP.DEPTNO;
         -- prev. line set the newly selected value
         TEMPNUMBER := TEMPNUMBER + 1 ;
         END LOOP;     
    END;
    2. problem is as we've to atleast initialize with one list item... that item can't be cleared with CLEAR_LIST.
    3. how can i actually clear that and still use cursor. because i've searched forum for this thing and found all those code not working ... for my project ...
    4. quick help needed ...

    Hi Omar,
    I have solution for you
    To populating or refreshing the lists you can use
    two procedures:
    One of them - generic, which can be used for all types of list
    Another is specific which contain a SQL statement to retrieve the data for
    particular list.
    1. Specific procedure:
    PROCEDURE GET_DEPARTMENT_LIST
    IS
    sql_stat VARCHAR2(32767);
    ret_code NUMBER;
    BEGIN
    -- SQL Statement for Drop-down List
    -- (must have two columns for label and value - both VARCHAR2)
    sql_stat := ' SELECT DEPARTMENT_NAME,TO_CHAR(DEPT_ID)'
    ||' FROM SCHEMA.DEPARTMENT';
    POPULATE_MY_LIST('BLOCK.DEPARTMENT_LIST',sql_stat,ret_code);
    END;
    2. Generic procedure:
    PROCEDURE POPULATE_MY_LIST
    (item_name VARCHAR2,
    sql_stat VARCHAR2,
    out_code OUT NUMBER)
    IS
    rg_id RECORDGROUP;
    rg_name VARCHAR2(100);
    ret_code NUMBER;
    item_id ITEM;
    BEGIN
         item_id := FIND_ITEM(item_name);
         IF ID_NULL(item_id) THEN
              out_code := -1;
              RETURN;
         END IF;
         --Creating Record Group with Unique Name
         rg_name := 'RG_'||SUBSTR(item_name,INSTR(item_name,'.',1)+1,LENGTH(item_name));
         --Checking Record Group Name for existance
         rg_id := FIND_GROUP(rg_name);
         --If Group does exist - delete it
         IF NOT ID_NULL(rg_id) THEN
              DELETE_GROUP(rg_id);
         END IF;
         --Creating Record Group
         rg_id := CREATE_GROUP_FROM_QUERY(rg_name,sql_stat);
    ret_code := POPULATE_GROUP(rg_id);
    IF (ret_code <> 0) THEN
         out_code := ret_code;
         RETURN;
    END IF;
    POPULATE_LIST(item_name,rg_id);
    IF NOT FORM_SUCCESS THEN
         out_code := -2;
         RETURN;
    ELSE
    out_code := 0;     
    END IF;
    DELETE_GROUP(rg_id);
    END;
    Hope it help.
    Dmitry

  • Cteate 2 Dynamic drop down list

    Hi all
    i want to create 2 dynamic drop down list using struts and hibernate
    i want the first one to display countries name then if i select a country name the second drop down list will automatic display the country cities .
    i'm using database here and my tables like that :-
    country table
    country_id number(3) pk
    country_name varchar(50)
    city table
    city_id number(5) pk
    country_id(3) fk references country(country_id)
    city_name varchar(50)
    thank you in advance

    Hi Omar,
    I have solution for you
    To populating or refreshing the lists you can use
    two procedures:
    One of them - generic, which can be used for all types of list
    Another is specific which contain a SQL statement to retrieve the data for
    particular list.
    1. Specific procedure:
    PROCEDURE GET_DEPARTMENT_LIST
    IS
    sql_stat VARCHAR2(32767);
    ret_code NUMBER;
    BEGIN
    -- SQL Statement for Drop-down List
    -- (must have two columns for label and value - both VARCHAR2)
    sql_stat := ' SELECT DEPARTMENT_NAME,TO_CHAR(DEPT_ID)'
    ||' FROM SCHEMA.DEPARTMENT';
    POPULATE_MY_LIST('BLOCK.DEPARTMENT_LIST',sql_stat,ret_code);
    END;
    2. Generic procedure:
    PROCEDURE POPULATE_MY_LIST
    (item_name VARCHAR2,
    sql_stat VARCHAR2,
    out_code OUT NUMBER)
    IS
    rg_id RECORDGROUP;
    rg_name VARCHAR2(100);
    ret_code NUMBER;
    item_id ITEM;
    BEGIN
         item_id := FIND_ITEM(item_name);
         IF ID_NULL(item_id) THEN
              out_code := -1;
              RETURN;
         END IF;
         --Creating Record Group with Unique Name
         rg_name := 'RG_'||SUBSTR(item_name,INSTR(item_name,'.',1)+1,LENGTH(item_name));
         --Checking Record Group Name for existance
         rg_id := FIND_GROUP(rg_name);
         --If Group does exist - delete it
         IF NOT ID_NULL(rg_id) THEN
              DELETE_GROUP(rg_id);
         END IF;
         --Creating Record Group
         rg_id := CREATE_GROUP_FROM_QUERY(rg_name,sql_stat);
    ret_code := POPULATE_GROUP(rg_id);
    IF (ret_code <> 0) THEN
         out_code := ret_code;
         RETURN;
    END IF;
    POPULATE_LIST(item_name,rg_id);
    IF NOT FORM_SUCCESS THEN
         out_code := -2;
         RETURN;
    ELSE
    out_code := 0;     
    END IF;
    DELETE_GROUP(rg_id);
    END;
    Hope it help.
    Dmitry

  • Dynamic drop down list in Adobe forms

    I have created a drop down list using enumerated drop down list from webdynpro native tab and binded in the object palette by giving $record.sap-vhlist.DESCR\.DATA\.FIELD.item[]* in the list items dynamically.DESCR is the field in the internal table into which i fetched data from the database table .I have written this code in a BADI.I dont know whether my form's display type is activex or native? I am not getting any values in the drop down list.can anybody please tell me what might be missing and how should i know whether my form is ActiveX or Native?
    My form is called from portal so i have used BADI to connect portal to form

    Hi sarang,
    I have done a dynamic drop down list in which DESCR field comes from database table and pops into the drop down dynamically. I was working for a PCR scenario so the adobe form was called from portal.I will tell u all the required steps.It might work for u as it is working for me:
    1.In the form:
    I used two elements from library first is a "ENUMERATED DROP DOWN LIST NO SELECT" from web-dynpro native tab and second is "ISR_TEXT DISPLAY INVISIBLE ON EDIT MODE" from ISR controls tab.Place them one on other inthe form.
    For drop down list the setting are:
         In object, field tab click on list items there in ITEMS put :$record.sap-vhlist.DESCR\.DATA\.FIELD.item[*].in ITEMS TEXT write text in ITEMS KEY write key.
         In binding,in default binding put $record.DESCR.DATA[*].FIELD.
    For text element the settings are:
         In binding,default binding put Normal.
         when we select ISR_TEXT DISPLAY INVISIBLE ON EDIT MODE it automatically comes with calculated read only int he value tab.so open script editor and place the below code:
    $record.DESCR.DATA.FIELD (in calculate).
    2.Now the code in BADI is as follows:
    In BADI we have to write the code for drop down list in the METHOD "SCENARIO_SET_ADDITIONAL_VALUES"
    As i didnt change the standard BADI i added an enhancement spot in which i wrote a function module which fills ADDITIONAL_DATA. and the below code fills the ADDITIONAL_DATA .
    DATA: t_t572b TYPE STANDARD TABLE OF t572b WITH HEADER LINE,
            t_t554t TYPE STANDARD TABLE OF t554t WITH HEADER LINE.
      SELECT * FROM t572b INTO TABLE t_t572b WHERE sprsl EQ 'E'.
      CLEAR ls_additional_data-fieldindex.
      LOOP AT t_t572b.
        ADD 1 TO ls_additional_data-fieldindex.
        ls_additional_data-fieldname ='DESCR_KEY'.
        ls_additional_data-fieldvalue = t_t572b-descd.
        APPEND ls_additional_data TO additional_data.
        ls_additional_data-fieldname ='DESCR_LABEL'.
        ls_additional_data-fieldvalue = t_t572b-descr.
        APPEND ls_additional_data TO additional_data.
        CLEAR t_t572b.
      ENDLOOP.
    For DESCR field the we have to declare  DESCR_KEY and DESCR_LABEL in the place holders for key values and palce holders for default values in characteristics tab(where all the fields for the form are defined) of ur respective scenario.(where ur pcr scenario is defined)
    Hope ur problem got resolved.
    Please let me know if any doubts.
    If ur form is not called from portal and u want a dynamic drop down list the difference is put a data drop down list and in object, field tab click on list items there in ITEMS select the field into which u populated the data from the database table (this code shud be written in code Initialization in the respective interface) and in ITEMS TEXT put $ in ITEMS KEY put $.and in binding as we normally do bind it to the respective field in which the data is populated from database table.
    It should work.

  • How to populate data from dynamic drop down list to the text field

    Hi,
    I tried to populate data from dynamic drop down list to city field. I would like to concat data from drop down list.When selecting add button to add the item and select item from drop down list, data should be displayed in the text field. However, Please help. I spent alot of time to make it works I am not successful.
    Please see the link below.
    https://acrobat.com/#d=SCPS0eVi6yz13ENV0cnUdw
    Thanks for your help
    Cindy

    Hi Rosalin,
    Loop the hidden table, get the values and populate drop down in each iteration.
    DropDownList1.addItem("Text","Value");
    You can use one more solution for this scenario. If it is a matter of 2,3 dropdowns, put three dropDowns in the form layout and give seperate static data binding to them. At run time make the dropDowns hide/visible as per the requirement.
    Hope this helps.
    Thanks & Regards,
    Sanoosh

  • How to create Dynamic Drop down list ?

    Hi experts
    I want to create a Dynamic Drop down list that should be an Editable,after editing that i need to save.
    thanks,
    vikram.c.

    Hello,
    Please go through this link:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/linking%2bdrop-down%2blists
    If useful reward.
    Vasanth

  • Dynamic table with dynamic drop-down list values

    Hi,
    I need to display a dynamic table with 2 columns on an interactive form.
    My Context is defined as below:
    Root
    StudentData     0..n
    StudentName
    StudentCourses     0..n
    Text
    Value
    The 1st column should display student name, 2nd column should display student courses. The courses will be different for each student. I populated the context properly. I checked it by printing them. My DDL is bound to "Student Courses".
    When there is one row -> The DDL is populated with the courses of student 1 (as there is only one).
    When there are more rows -> The DDLs for all the students are populated with all the courses of all the students.
    I want to see the data populated like:
    TEXTFIELD    DROP-DOWN LIST
    Student 1------Student1-Course1
    Student1-Course2
    Student1-Course3
    Student 2------Student2-Course1
    Student2-Course2
    Student2-Course3
    I tried to do this in plain web dynpro using SVS.. it is also working similarly.
    I have set the singleton property of nodes "StudentData" and "StudentCourses" to false.
    Could any one tell me where I am going wrong?
    Thanks
    Ram

    Ram,
    I'm not sure how much this will help, but I know I had the same problem as you when I tried to get a similar thing working, but I can't remember which of the many changes I made fixed the problem, so I'll just show you my code and perhaps you can see if anything is different than yours.
    Here's where I'm creating my dropdown - in my case EastNew_RegOut is the same as your StudentData, and RateTypeDropValues is the same as your StudentCourses (the comments in the code are not meant to sound bossy to you, this is actually an example piece of code that other developers in my company "steal", so I have to put very specific instructions in there!):
    int nodeSize = wdContext.nodeEastNew_RegOut().size();
    for (int i = 0; i < nodeSize; i++) {
         //create an element called "table", that's the element at i.  So, basically it's a row.  Maybe I should have
         //called it "row" instead of table.
         IPublicDeviceExchange.IEastNew_RegOutElement table = (IPublicDeviceExchange.IEastNew_RegOutElement)wdContext.nodeEastNew_RegOut().getElementAt(i);
         //this line of code just executes an rfc that finds out what rates need to be in the dropdown for this particular row
         executeRateTypeDropdown(rateCategory, table.getNum(), wdContext.currentEastNew_MeterOutElement().getReggrp());
         //clear out what's already in there before we re-populate it.
         table.nodeRateTypeDropValues().invalidate();
         //now, I'm looping through all the values in the *actual* rate type dropdown (the one that's an RFC, populated by the above "execute" method)
         for (int j = 0; j < wdContext.nodeEastRatetype_DropdownOut().size(); j++) {
              //for each element in the *actual* Rate type dropdown, I'm going to create an element in my node that I created
              //and set the values from the *actual* one as the values in my node.
                        IPublicDeviceExchange.IRateTypeDropValuesElement element = wdContext.createRateTypeDropValuesElement();
              IPublicDeviceExchange.IEastRatetype_DropdownOutElement rateTypeOut = (IPublicDeviceExchange.IEastRatetype_DropdownOutElement)wdContext.nodeEastRatetype_DropdownOut().getElementAt(j);
              element.setText(rateTypeOut.getText());
              element.setValue(rateTypeOut.getRatetype());
              //here's another key - notice how I don't say wdContext.nodeRateTypeDropValues() - it's the one that's
              //directly off that table I created earlier - the thing that's essentially a row in my newReg table.
              //So, what I'm doing here is adding that new element I created to the dropdown FOR THAT ROW!               
              //(btw, if you're trying to duplicate this, and this method does not exist for your "table" object, it's
              //probably because you didn't listen to me above and you didn't create your node with the singleton property
              //set to false.)
              table.nodeRateTypeDropValues().addElement(element);
    As for my layout... my table is bound to the EastNew_RegOut node, and the column with the dropdown is bound to RateTypeDropValues.Value  (that's probably obvious, but there you have it anyway)
    Finally, in my context, EastNew_RegOut is singleton = true (I was surprised about this, actually, I would have assumed it was false) with a selection of 0..1 and RateTypeDropValues has singleton set to false with a selection of 0..1
    I hope that helps to some degree!
    Jennifer

  • How to add a dynamic drop down list in RDLC reports in WPF

    I have to Load an RDLC report in WPF application and need to include a drop down list in report.Based on the selection of drop down list different reports to be generated.I am using C# and WPF.
    Eg: I have to list the details of employees in in RDLC report.There is a country drop down list, Based on the selection of country drop down list we need to display details of employees in the selected country.

    Looking good.
    With rdlc I think you will have to use the windows report viewer control.
    If this was SAP crystal reports there's a wpf report viewer.
    I never actually tried that with rdlc and I suppose there is a small chance they turn out to be compatible.  
    If you have questions on rdlc specifically then you're probably better finding a forum specialises in that. Not sure where that would be but maybe in the sql server forums.  It's a business intelligence thing and people who do the likes of ssis are
    what you want really.
    I do reporting myself but I think you'll find few others who do so here.
    Good luck.
    Hope that helps.
    Recent Technet articles:
    Property List Editing;  
    Dynamic XAML

  • Dynamic drop down list in jsp

    Hi -
    I have written a piece of code to dynamically include data in the drop down list after querying the data base. I can print the values using out.print().. but they do not show up in the drop down list. Below is the code -
    Please lemme know the mistake i am committing. Thanks you!
    <form name="browse" method = "POST">
    <select name="uid">
    <%
    //out.write("before vec");
    unit.setCid(user.getCid());
         Vector unitNumbers = unit.getUnitNumbers();
         ListIterator iter1 = unitNumbers.listIterator();
              while ( iter1.hasNext() ){
                   Integer num = (Integer)iter1.next();
    //               out.print(num.intValue());
    //               out.print("Hellooooooooo");
    %>
    <options> <%= num.intValue() %>
    <% }
    %>
    </select>
    </form>

    The correct tag should be <option value="val">Val</option>, like this:
    <form name="browse" method = "POST">
      <select name="uid">
        <%
          unit.setCid(user.getCid());
          Vector unitNumbers = unit.getUnitNumbers();
          ListIterator iter1 = unitNumbers.listIterator();
          while ( iter1.hasNext() )
            Integer num = (Integer)iter1.next();
        %>
        <option value="<%= num.intValue() %>"><%= num.intValue() %></option>
        <% } %>
      </select>
    </form>

  • Dynamic Drop down list

    Hi Friends,
    I am working on a Drop down list in Adobe Interactive Form.
    I have a internal table contaning some values, i have binded my dropdown element wiht the field of the table containing the values. Thatu2019s working fine an I can select on value from the drop down list.
    I want to add a new value to select another value from the drop down list or delete it.
    The scenario is that when I click on add-Button to selects another value from the drop down list in subform,  I add another Drop down list, but I canu2019t open the second or third drop down to select the value.
    Iu2019m a new in JavaScript. I thing a missing something in JavaScript, wenn I click add-Button
    Please let me know what is missing or send me an exampel.
    Thanks and Regards.

    Hi Chintan,
    Thank you for your help.
    I will try to explain more clearly my problem .
    In my case, my form will be used in ABAP system without any web dynpro applicatoin . forms are send by mail and retrieve by mail in SAP .
    I define a PDF forms in the ABAP stack of SAP . in the form i create a table subforms , number of rows depend on what is store on the database.
    In the fact, my field is defined as dropdownlist box and value are link to the content of the interface attributes .
    For thr first row that works fine but when i add a line, the content is not populate automaticaly, and i can' t open the dropdownlist.
    When user receive the forms, he can add lines to the table while it's define as dynamic. My problem is that on NEW LINE the dropdownlist box is empty.
    How can i solved this issue ?
    Tanks

  • Dynamic Drop Down List Trouble in Dreamweaver

    I am having trouble with Dreamweaver 8 and php with MySQL.
    Basically, I have a main page, index.php that includes a
    header file that I use to display my header using readfile like
    this:
    <?php readfile("header.php"); ?>
    Inside of header.php, there is code to create a drop down
    list. I am trying to populate this list from my database, but I
    cannot get this to work.
    This is the code snippet:
    <form name="storeShowSelect" method="GET"
    class="sf_select" target='newwin'>
    <input name="selectStore" type="hidden" value="17999">
    <select name="storeSelect"
    onChange="jumpToLink(this);">
    <option disabled selected >--- Select a store
    ---</option>
    <?php
    do {
    ?>
    <option value="<?php echo
    $row_marketplaceStoreNames['storeName']; ?>">
    <?php echo
    $row_marketplaceStoreNames['storeDisplayName']; ?>
    </option>
    <?php
    } while ($row_marketplaceStoreNames =
    mysql_fetch_assoc($marketplaceStoreNames));
    ?>
    </select>
    </form>
    It looks like this is only inserting one blank row in the
    drop down list. When testing my recordset in Dreamweaver, I do get
    the rows of data that I am expecting.
    Can anyone possibly help me figure out what I am doing wrong
    here?
    Thanks in advance,
    Mona

    I am having trouble with Dreamweaver 8 and php with MySQL.
    Basically, I have a main page, index.php that includes a
    header file that I use to display my header using readfile like
    this:
    <?php readfile("header.php"); ?>
    Inside of header.php, there is code to create a drop down
    list. I am trying to populate this list from my database, but I
    cannot get this to work.
    This is the code snippet:
    <form name="storeShowSelect" method="GET"
    class="sf_select" target='newwin'>
    <input name="selectStore" type="hidden" value="17999">
    <select name="storeSelect"
    onChange="jumpToLink(this);">
    <option disabled selected >--- Select a store
    ---</option>
    <?php
    do {
    ?>
    <option value="<?php echo
    $row_marketplaceStoreNames['storeName']; ?>">
    <?php echo
    $row_marketplaceStoreNames['storeDisplayName']; ?>
    </option>
    <?php
    } while ($row_marketplaceStoreNames =
    mysql_fetch_assoc($marketplaceStoreNames));
    ?>
    </select>
    </form>
    It looks like this is only inserting one blank row in the
    drop down list. When testing my recordset in Dreamweaver, I do get
    the rows of data that I am expecting.
    Can anyone possibly help me figure out what I am doing wrong
    here?
    Thanks in advance,
    Mona

  • How to populate active directory users in to drop down list items dynamically in Share point 2010 ?

    Hi My self Arun in my current project i have a task on that active directory user  need to automatically populate in share point list drop down  please help me.  is that any out of box feature in share point 2010 ?   
    Thanking You 
    Arun 

    Arun,
    If you plan to implement the "Querying the Active Directory" based on my code snippet,
    and if you do not have permission [your account must be the part of domain admin] to do so,
    Then still you can do it in least effort through code,
    string usersInXml = SPContext.Current.Web.AllUsers.Xml;your xml string look like this.
    <Users><User ID="2" Sid="" Name="Administrator"
    LoginName="i:0#.w|murugesan\administrator" Email="" Notes="" IsSiteAdmin="True" IsDomainGroup="False" Flags="0" /><User ID="1" Sid="" Name="Murugesa Pandian" LoginName="i:0#.w|murugesan\murugesan" Email="" Notes="" IsSiteAdmin="True" IsDomainGroup="False" Flags="0" /><User ID="1073741823" Sid="S-1-0-0" Name="System Account" LoginName="SHAREPOINT\system" Email="" Notes="" IsSiteAdmin="False" IsDomainGroup="False" Flags="0" /></Users>
    You can user Linq to XML to filter the "LoginName,Name and Email and then populate your drop down list.
    * User must be logged into the site at least once.
    Murugesa Pandian.,MCTS|App.Devleopment|Configure

  • Populate a drop down list with data from Excel and fill in a text field, based on drop down selectio

    Hi!
    I have a problem with a PDF form: There's a drop down list that I populate with Excel data that I've put in an XML file through an XSD file -- no problem here. The drop down list has a data binding to the XML file, so that a choice in the drop down list can be associated with an object in the XML file. So, when I make a choice in the drop down list, a corresponding object value is fetched from the XML file and put in a text field on the form.
    How to do this is described by Stefan Cameron here:
    http://forms.stefcameron.com/2006/07/29/dynamic-properties/
    There's a snag, though, and to describe it more clearly:
    The XML file contains three types of objects: role, role number, and role cost center. Of these I use the first and the third, i.e. the role and the role cost center. The drop down list contains the roles, and when I select a role, the corresponding cost center is filled out in the text field. So far, so good!
    But -- if the cost center has the same value for two or more roles, all of these roles "bounce back" into the drop down list, that is, they are all selected in the drop down list. How many of these you can see depend on the height of the drop down list -- if it's low you'll only see the first one.
    If I modify Stefan Cameron's data in his example I get the same behavior, so the problem seems to have to do with how XML data are fetched.
    I'm sure there's a workaround, but I can't find it! I've spent many hours browsing the web without finding anyone with a similar problem.
    Any suggestions appreciated!

    Although your issue is far beyond mine, I was hoping you can help me out.....
    I need to create a drop down list of names which I wish to somehow link to an Excel spreadsheet.
    Please let me know the steps I need to do.  I've tried several things, but nothing seems to work and I'm not sure what I am doing wrong.
    Thank you

  • Error while populating drop down list with values from a database

    Hi all,
    I have a JSP page with a drop down list that is to be populated with values from a database.
    This is the code in my JSP file:
         <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) { %>
                       <option value="<%=iterator.next().intValue()%>"> <%=iterator.next().intValue()%> </option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>   The DataManager.java class simply forwards this to its respective Peer class, which has the code shown below:
          package seatplanner.model;
        import java.sql.Connection;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        import java.sql.Statement;
        import java.util.ArrayList;
        /* This class handles all floor operations */
         public class FloorPeer
         /* This method returns all the floor numbers */
         public static ArrayList<Integer> getAllFloorNumbers(DataManager dataManager) {
            ArrayList<Integer> floornumbers = new ArrayList<Integer>();
            Connection connection = dataManager.getConnection();
            if (connection != null) {
              try {
                Statement s = connection.createStatement();
                String sql = "select ID from floor order by ID asc";
                try {
                  ResultSet rs = s.executeQuery(sql);
                  try {
                    while (rs.next()) {
                      floornumbers.add(rs.getInt(1));
                  finally { rs.close(); }
                finally {s.close(); }
              catch (SQLException e) {
                System.out.println("Could not get floor numbers: " + e.getMessage());
              finally {
                dataManager.putConnection(connection);
            return floornumbers;
         }  The classes compile properly, but when I load this page up in Tomcat it just freezes and does not load the form. I tested the DB connection and it works fine.
    What am I doing wrong in the JSP code?
    Thanks for the help in advance.
    UPDATE: I commented out the form, and added <%=floornumbers.size()%> right above the commented code to check if the ArrayList is indeed getting populated with the values from the database (the values are of type integer in the database). The page still freezes like before. I'm puzzled now :confused: .

    Wrong usage of Iterator.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) {
                                    Integer inte = iterator.next();
                            %>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>or make use of enhanced loop as you are already using J2SE 5.0+ for avoiding confusions.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% for(Integer inte:floornumbers) {%>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <%}%>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>and a lot better thing would be making usage of basic Taglib provided with JSTL spec or struts spec which make life easier and simple.
    something like usage of <c:forEach/> or <logic:iterate/> would be lot better without writing a single scriptlet code.
    Hope that might help :)
    REGARDS,
    RaHuL

Maybe you are looking for

  • Foxfire crashes unexpectedly when in yahoo games.

    For the past 2 or so weeks, while playing yahoo card games (euchre and pinochle), foxfire crashes unexpectedly and boots me out of the game/site.

  • WM Pick List (CO27 - Pick Profile)

    Hi, In transaction CO27, we would like to add ON-HAND stock quantity as one of the report column. But unfortunately, this field is not available under the option Prof. field select through configuration tcode KOMM. Does anyone know of a way to add ne

  • Palm Centro Unlock Button

    The key unlock button on my Palm Centro has ceased to work.  The only way to access the phone is to remove and replace the battery then use it before it goes to the sleep mode.  Has anyone else encountered this problem, and how did you solve it? Than

  • Thursday is the last day to vote for your favorite authoring tool

    Hi, folks. Thursday, January 6 is the last day to vote for your favorite authoring tool! WritersUA is inviting help authors to participate in it's annual tool survey. http://www.surveymonkey.com/s/tools_survey It's not long, just a page. I'd encourag

  • MDNSResponder crashing every 10 seconds

    iMac running OSX 10.8.4. Have had periodic crashes over the last few months, but did a software update last night and its all got much worse. The console is showing mDNSResponder crashing every 10 seconds. In terms of apps, most apps I try to start e