Populating select list in a JSP with enumeration values

I'm working on a JSP in which I need to populate a select list with enumeration values.
Everytime I'm trying to insert these values (using enum.nextElement()) in a select box only the first enumerated value gets inserted correctly, the rest of the values shows up outside the select list. I would appreciated any help...thanks!!!

I'm not exactly sure how your generating your list to begin with, however the following code will work:
<form>
<select>
<%
     java.util.Vector v = new java.util.Vector();
     for(int i=0;i<12;i++){
          v.addElement(new Integer(i));
     java.util.Enumeration enum = v.elements();
     while(enum.hasMoreElements()){
     Object obj = enum.nextElement();
     out.println("<option name='"+obj+"'>"+obj+"</option>");
%>
</select>
</form>Anthony
BTW does anyone know why the greater than symbol never renders properly in these forums when text is encapsulated in the code tag?
pre:
>code:
>

Similar Messages

  • Error in select list w/submit proccessing with IE

    I have encountered a problem that is only IE specific. The page is a basic page with an Automated Row Processing to insert the form to a table.
    Once the form has been filled out and you press create there are seven total fields including a hidden field (p173_model_id) that is populated by a database trigger and sequence. All of the fields in essence save to session state to the field following that field. So for instance the vendor_id saves to the model_number field. The model_number field saves to the status field and so on! This only occurs with IE though not with FF. In FF everything works as planned.
    Also if you change the container Type field from select list with submit to just select list the form handles fine now in IE.
    Attached are pictures trying both IE and FF:
    FF
    IE
    You can view the backend @
    workspace:epic
    guest/guest
    http://apex.oracle.com/pls/otn/f?p=9579:173
    Thanks
    Justin

    Here is an update in case anyone else experiences the problems I had...
    The SR request I filed was given bug # 5716829 I am not sure if this is published or not....
    Anyway here is what the development staff reported back:
    I have narrowed this problem down to the Read Only Condition on the P173_CONTAINER_TYPE_ID select list.
    If you remove "DISABLED" from the Read Only Element Table Cell(s) Attributes, it works fine in IE also. So, the problem seems to be
    with the way IE handles Select Lists that are DISABLED.
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    You may use that as a workaround until the fix is available...

  • Select an Entry in a (populated) Select List

    Hi,
    I have got a table PERSON (id, name, firm_id) and a table FIRM (id, name).
    I have got a report that shows me all persons: name, firm.name (where PERSON.firm_id = FIRM.id)
    When I edit a person, the detail page opens. I want to see the name of the firm instead of the firm_id. Therefore I added a select list where the user can choose a firm. The list is populated correctly with all firm names (and their IDs):
    select name d, id r from firm order by 1
    So far so good, but: The selected entry in this list is always the first one (<please select a firm>).
    What do I have to do that the select list shows me the correct firm? In other words: How do I tell the select list, what the firm_id of the shown record is?
    Step 2: When I click the save button: How do I tell the application that PERSON.firm_id has to be taken from the select list?
    Thanks for any help,
    -- zebu

    Thanks Dietmar
    When creating the application I have selected "Report and Form" and added both tables (FIRM and PERSON), both as top-level pages (i.e. none is subordinated to the other).
    What I got is 4 pages (the two forms on rows 2 and 4 are a little bit indented):
    Page     Page Name     Page Type     Source Type     Source     
    1     FIRM     Report     Table     FIRM
    2     FIRM     Form     Table     FIRM
    3     PERSON     Report     Table     PERSON
    4     PERSON     Form     Table     PERSON
    I all other steps I have choosen the default. At the end, the application builder shows me 5 pages: The 4 above plus the login page.
    Remark: Up to this point everything was automatically generated. This changes now:
    When I look at the PERSON Form now, I have the attribute PERSON.firm_id. That works perfectly. But I want the select list with the firm names (from the FIRM table). Therefore, in the Items list of the PERSON-Form-Page I delete the "firm_id - text field" and replace it with "firm - select list". The select statement is: select name d, id r from firm order by 1.
    In the "Edit Page Item" for the select list I wanted to tell the application, which of the loaded values shall be selected. But I don't know where and how.

  • Multiple Select List does not Refresh with Dynamic Action

    All,
    Scenario:
    Using APEX 4.2.2, I have a Select List page item (P4_SPONSOR) set to allow multiple values which has a dynamic LOV to populate the list.  What I would like to do is highlight the display values based on another page item's value (P4_DRIVER_ID).  When I set the source of P4_SPONSOR to static text, such as a delimited string of 1:2:3:4, any display values where the return values are equal to the static text are highlighted when the page loads.
    Problem:
    The problem lies in trying to use a query as a source for P4_SPONSOR which is filtered based on the other page item, P4_DRIVER_ID.  For instance, my SQL Query (returning colon separated values) returns the same as the static text noted above.  In the query's WHERE clause, I specify that the driver's ID is equal to P4_DRIVER_ID:
    SELECT sponsor_id
    FROM sponsors_drivers_xref
    WHERE driver_id = :P4_DRIVER_ID;
    This, as I understand it, would necessitate a refresh of P4_SPONSOR whenever the value of P4_DRIVER_ID changes.  So, I have a Dynamic Action that does just that.  When executed on the page, I can see the P4_SPONSOR multiple select list actually refresh, but none of the display values become highlighted.
    Thoughts?
    Thanks,
    -Seth.

    Seth,
    A dynamic action refresh of your select list will refresh the list of values (this is what you are seeing), it will not refresh the value of the item itself.  In fact, it will remove any values that you had already selected.  To refresh the value you will need to add additional dynamic actions.
    Create another dynamic action with:
    Event: After Refresh
    Selection Type: Item(s)
    Item(s): P4_SPONSOR
    If this was a normal select list you could just create a Set Value action and use your query to set the value of the select list.  Since this is a multiple select list your will need to get your colon delimited value first and then use some javascript to set the values of your select list.
    Create an hidden page item name P4_SPONSOR_TEMP.
    Add a true action to your new dynamic action:
    Action: Set Value
    Set Type: SQL Statement
    SQL Statement:
    SELECT sponsor_id
    FROM sponsors_drivers_xref
    WHERE driver_id = :P4_DRIVER_ID;
    Page Items to Submit: P4_DRIVER_ID
    Selection Type: Item(s)
    Item(s): P4_SPONSOR_TEMP
    Add another true action to your new dynamic action:
    Action: Set Value
    Set Type: JavaScript Expression
    JavaScript Expression:
    $("#P4_SPONSOR_TEMP").val().split(":")
    Selection Type: Item(s)
    Item(s): P4_SPONSOR
    --Jeff

  • Apex_item select list to be displayed with multiple default values

    I am using APEX 4.2.
    For one of our requirements , we are displaying a report which uses "apex_item.select_list_from_query" multiselect field.
    The above function accepts a parameter, 'p_value' using which we can specify the default value to be highlighted.
    Is there any way to highlight multiple values on the select list by default, when the page is loaded, based on a sql output.
    Sample Scenario:
    Say colour is a multiselect field. Full list of values available : R, B, G, Y, O
    On day1, for record1 i am choosing R and B. which I am saving in the backend when the page is submitted.
    On day2 : I login again to see the report. When the report is loaded, I should see the values 'R' and 'B' highlighted or in a different font format , differentiated from the rest.
    Thanks in advance for your replies.
    Regards,
    Raasi
    Edited by: 878815 on Mar 11, 2013 10:23 PM

    878815 wrote:
    I am using apex_item.select_list_from query. and then a piece of javascript to concatenate as a colon delimited string. This is the function I am using in the report sql,
    apex_item.hidden(20,null)||apex_item.select_list_from_query(6,null,'<sql>','multiple size = "6" onChange="Multi(this)"','NO' ) as col_1I think 'multiple size' is a custom attribute and APEX have no clue about it.
    javascript code:
    function Multi(p_this)
    var l_selected=html_SelectValue(p_this);
    if (l_selected.constructor == Array) l_selected=l_selected.join(':');
    p_this.parentNode.firstChild.value = l_selected;
    return l_selected;
    };What is this apex_item.hidden used for.. placeholder?
    May be populate the hidden item with default value as colon delimited string and on page load use some JavaScript to read that string and set/highlight the select list.
    It would be easy if you can replicate the issue on apex.oracle.com

  • LOV is not populating when pressing tab in OAF with common value

    Hi,
    How to make the LOV gets populated after entering any value and press the tab button.
    For ex: If i enter item number "100012" and press tab then the LOV is displaying the values and item description is auto-populated.
    In my case there are two values with '100012'..once i enter this value and press tab it says Loading, but no options comes up. “Loading” just goes away. But when i clicked on lov icon am seeing the values...
    I checked disable validation is not set to true, it has been set to false.
    Pls give me any suggestions.
    Regards
    --Harry                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi Naren,
    Sorry for late response...am sick actually....
    yes, In my case there are two item numbers '100012', with different vales(in lov region teble).
    Regards
    --Harry                                                                                                                                                                                                                                                                                                                                                                   

  • Value of Multiple-Selection List box is not appearing "calculated value" field of it

    Hello,
    We have created one selection list box using control "Multiple Selection List Box", where user can select one or more values.
    We have created one view in InfoPath form, which have calculated value of fields(just showing purpose and printing purpose this view has ben created).
    In this when we try to show calculated value of field is of Multiple Selection List Box, it's showing as "Off".
    Could you please help us out.
    Thanking you in advance.
    Regards,
    Jayashri

    Hi,
    Thanks for your sharing! It will be beneficial to others in this forum who meet the same issue in the future.
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Best approach for select lists to hold more than 3000 values urgent plz

    Hello,
    I have an interactive report in which I have made one of the column as a editable dropdown list item using the APEX API ITEM APEX_ITEM.SELECT_LIST_FROM_QUERY_XL, I am getting an error saying that
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    I think the drop down list is not able to hold that many values. The number of values can grow in the future.
    Can anyone suggest me any other approach to resolve this issue.
    Thanks,
    Orton
    Edited by: orton607 on Apr 7, 2010 12:28 PM

    thanks for your reply.
    Yes I have tried but the popup lov is not returning a value to my report when i click a value on the POPUP lov.
    So I did it in another way, the same problem exists again its not returning the value.
    Like I have a interactive report, in which I have have made one of column as an editale text item and concatenated it with an image when clicked on the image
    opens up an popup report (interactive report)
    Source query of the Report
    select
    apex_item.hidden(04,CHF_TABLE_KEY,' ','f04_' || ROWNUM)
    || APEX_ITEM.HIDDEN(01,ROWNUM,'','f01_' || ROWNUM) " ",
    APEX_ITEM.TEXT (25,CHF_SOURCE_TABLE,30,NULL,'f25_' || ROWNUM)
    || ' '||'<img height="18" align="middle" width="18" style=""
    alt="Source Table Popup" src="/i/lov_16x16.gif"
    onclick="javascript:popUp2(''f?p=&APP_ID.:50''||ROWNUM);" />' SOURCE_TABLE_EDIT,
    CHF_SOURCE_DATASTORE,
    CHF_SOURCE_SCHEMA,
    CHF_SOURCE_TABLE
    FROM CHF_TABLE_SOURCE
    ORDER BY CHF_SOURCE_TABLE
    My popup is an interactive report (Region source: select distinct chf_table from chf_table order by 1) which contains only one column which is a link column
    whose link Text: #CHF_TABLE#
    Target: URL
    URL: javascript:CallReport('#CHF_TABLE#');
    P50_PITEM is the hidden item.
    Javascript for the popup page HTML Header is
    <script type="text/javascript">
    <!--
    function CallReport(pVAl)
    var s_item = 'f25_'+ &P50_PITEM.;
    javascript:$v_PopupReturn(pVAl,s_item);
    //-->
    </script>
    My problem is, like when I click the image a popup report window appears but I am not able to return the value when I clicked the link column on the popup report page.
    Can you please help me out with this issue.
    thanks,
    Orton
    Edited by: orton607 on Apr 7, 2010 11:05 AM

  • How to make dynamic select list with time interval of 15 minutes

    Dear all,
    I've a question. I need a select list that contains time with intervals of 15 minutes from 08:00 till 16:00.
    example 8:00
    8:15
    8:30
    8:45
    9:00
    9:15
    and so on till 16:00
    The values or stored in a varchar column.
    Can someone please help me with this one?
    Best regards,
    Caroline

    I think the easiest way would be to create a table "INTERVALS" with one row and column "INT_PERIOD"? per 15 minute period description
    8:00
    8:15
    16:00
    Then create your select list item based on a Dynamic List, or Query as
    SELECT int_period d, int_period r
    FROM INTERVALS
    ORDER BY INT_PERIODYou could write something to load the table, but that might take about as long to just edit in the values.
    Making it a Dynamic LOV, you then have it available anywhere else you might need it.
    Edited by: Bob37 on May 4, 2012 8:57 AM

  • How to write a PL/SQL select list with submit page?

    Let's we need some select list that are related with each other. I wrote such a code.
    declare
    gn_start_id number := 0;
    glabel1 VARCHAR2(100) := 'Group ';
    glabel2 VARCHAR2(100) := 'Property';
    begin
    htmldb_application.g_f01(1) := 100;
    htp.p('<BR>');
    htp.p
    ( glabel1 || ' : ' ||
         htmldb_item.select_list_from_query
         p_idx => 1,
         p_value => '--Select a value--',
         p_query => 'SELECT m.vproperty, m.NMAP_PK_ID
              FROM table m
              WHERE m.ngroupid = ' || to_char(gn_start_id),
         p_show_null => 'NO',
         p_null_value => 0)
    htp.p('<BR>');
    htp.p
    ( glabel2 || ' : ' ||
         htmldb_item.select_list_from_query
         p_idx => 2,
         p_value => '--Select a value--',
         p_query => 'SELECT m.vproperty, m.NMAP_PK_ID
              FROM table m
              WHERE m.ngroupid = ' || to_char(htmldb_application.g_f01(1)),
         p_show_null => 'NO',
         p_null_value => 0)
    end;
    However, I am not able to submit page automaticly, when user select a value from the select list?
    How can I do this? Thankz

    I found such a solution.. thanks
    htp.p('</TD><TD>');
    htp.formselectopen(cname => 'v_status', cattributes => 'class="ddl" onChange="javascript:update_status(this.value)"');
    FOR rec IN cur_status LOOP
    IF rec.status_id = v_status THEN
    htp.formselectoption(cvalue => rec.status_name, cattributes => 'value="' ||
    rec.status_id || '"', cselected => 'TRUE');
    ELSE
    htp.formselectoption(cvalue => rec.status_name, cattributes => 'value="' ||
    rec.status_id || '"');
    END IF;
    END LOOP;
    htp.formselectclose;

  • Keeping cursor in same item where Select List with Submit is ued

    Hi,
    I am using Select List with Submit and when I do this and redirect to same page, cursor focus goes to first item in region or page.
    How to keep the cursor in same item?
    Pl Help as I am not very sure to it in Java Script and i am having such items more than 50 per page.

    APEXDeveloper,
    Try this:
    Suppose ur select list with submit is "P1_SELECT" and the item to set focus on is "P1_MAIN".
    In ur page HTML Footer, use something like:
    <script language="javascript">
    if($x('P1_SELECT').value!="")   ---> when a value is selected in the select list (assuming that the select list can also display a null value)
    {$x('P1_MAIN').focus();}
    </script>Hope this at least gets u started.

  • Using multiple select lists in ADF

    Hi,
    I am trying to use a multiple select list in my JSP page, and have a method in the ApplicationModule be called when the Struts action is called. I am following the example ADF tutorials, where the method is added to the ApplicationModule class, then dragged onto the Stuts Flow diagram (to associate it with an action).
    I am able to create a dyna form bean for the page that contains the multi select as a type "java.lang.String[]" (string array). I am able get that values that were selected in a normal action's "execute" method. For example:
    msf = (DynaActionForm) form;
    String[] statusSelection = (String[]) msf.get("multSelectList");
    However, I cannot seem to get the "multSelectList" values into a method in my Application Module class. The "multSelectList" is defined in my dynaFormBean as a String[] type. I am passing it in as an argument like the following....
    public void setParams(String multSelectList[]) {
    This results in the method not being called at all. I am not sure why. Does this have something to do with a String[] not being serializable??
    However, if I just attempt to pass other types form items to the method, it works. For example:
    public void setParams(String simpleCheckbox) {
    Does anyone know how to use multiple select lists in conjunction with ADF?
    P.S.
    my multSelectList looks something like this:
    <select name="multSelectList" multiple size="5">
    <option value="ALL">Select All</option>
    <option value="preferred">Preferred</option>
    <option value="standard">Standard</option>
    <option value="approved">Approved</option>
    <option value="interim">Interim</option>
    </select>

    I got this working by changing the signature of the Application Module method to use ArrayList rather than String[], then you can marshal the Struts FormBean contents into an ArrayList to pass up.
    To do this, subclass the DataAction by using "Go To Code" off of the context menu and then override the initializeMethodParameters() method:
      protected void initializeMethodParameters(DataActionContext actionContext, JUCtrlActionBinding actionBinding)
        //Get the String Array from the Form Bean
        String[] selection = (String[])((DynaActionForm)actionContext.getActionForm()).get("multiSelect");
        //convert that to an ArrayList
        ArrayList selectionArr = new ArrayList( Arrays.asList(selection));
        //Add that object to the Arg List for the AM method
        ArrayList params = new ArrayList();
        params.add(selectionArr);
        actionBinding.setParams(params);
      }

  • LOV single selection list is not working in my JDeveloper 10.1.2.3

    Hi!
    I'm stumped with this. I'm also new to JDeveloper. I used the sample tutorial from the OTN website entitled "JSPDataBoundLists.jws" to learn how to create drop-down lists in JDeveloper.
    My problem is I created a single selection list LOV from DepartmentListView Data Control and pasted it into an EmployeesView Input form. This is so I can just select the Department names to populate the DepartmentID field in Employees table. I setup the data binding in the UI Model of my jsp using the "List Binding Editor". I checked the UIModel file and it looks as follows:
    <DCControl
    id="DepartmentId2"
    SubType="DCListSingleSel"
    IterBinding="EmployeesViewIterator"
    DTClass="oracle.adf.dt.objects.JUDTCtrlListLOV"
    ApplyValidation="false"
    isDynamic="false"
    ListOperMode="0"
    ListIter="DepartmentsListViewIterator" >
    <AttrNames>
    <Item Value="DepartmentId" />
    </AttrNames>
    <ListAttrNames>
    <Item Value="DepartmentId" />
    </ListAttrNames>
    <ListDisplayAttrNames>
    <Item Value="DepartmentName" />
    </ListDisplayAttrNames>
    </DCControl>
    I run the jsp, selected a value from the drop-down list, do a submit and do a commit, but the DepartmentId from the DepartmentsListView was not stored in Employees. What is wierd here is that there is an exact same single selection list defined a row above mine which is working fine. How come that one is working and mine is not?

    Eureka! I finally found the answer to my own question!
    This simple problem of adding a drop-down list into a jsp page cost me 3 whole days (around 24 full working hours) to find the answer. Normally it only takes me a few minutes with the other web app languages I've learned. And I just stumbled into the answer just a few minutes ago (maybe all thanks should be given to God whom let me stumble into the answer since me and my wife have been praying for several weeks now ever since I started trying to learn Oracle JDeveloper. It is really very very difficult and time consuming to learn compared to other web app languages and tools).
    Anyway, the reason why my LOV does not work in my jsps using JDeveloper 10.1.2.3 is because JDeveloper 10.1.2.3 seems to allow only one input-form-element for the same field of the input table!
    For example, what happened to me was I had an input form created for the Employees table in the HR schema. I did this simply by drag-and-drop from the "Data Control Palette". This feature I like very much with JDeveloper. It is really easy and works instantly. And then, I drag-and-drop the departmentname field from the Departments table as a "single selection list" into the jsp and setup its bindings. So when I run the jsp, viola! The drop-down list does not populate the DepartmentId field of the Employees table. IT DOES NOT WORK! I've tried reinstalling both JDev and Oracle db and JDKs to no avail! I tried posting in this forum to no avail! I tried experimenting with newly created jsps to no avail! Then suddenly after repeatedly experimenting on this on different tutorials, guides and my own web app, it works! Why did it work? It was because I tried to add an LOV-single-selection-list on another sample tutorial with a READ-ONLY FORM on the jsp! Thus only the LOV is the input-form-element in the jsp for the table's field.
    So why can't you find such a simple and basic fact anywhere in the web, the tutorials, guides or the forum? I do not know. Maybe only I am using such an old version of JDev? But what about the users who used it when it just got out a couple of years ago? Didn't they have the same problem? Anyway, it seems like the answer to a lot of my simple basic questions about JDeveloper is not documented, or is buried very deep beneath all the other words of all these documents. Hopefully JDeveloper's documentations would get a lot easier to use very very soon!

  • Creating a dynamic Selection List based on a View Object

    Hello,
    I'm new to JDeveloper and I would like to create a JSP Page with dynamic Selection List based on a runtime query or based on a view object (BC4J). The selection made by an user should serve another dynamic query with the necessary parameters that I built using createViewObjectFromQueryStmt(). By now I tried this using the InputSelectLOV from the Component Palette in JDeveloper. But without success. By the way: the selection list is not very large (5 values), so it's not necessary to have a form finding the desired value.
    Maybe someone had experience about creating this already. Please give me a tip or a little example.
    Thanks.

    http://otn.oracle.com/products/jdev/howtos/jsp/renderers.html

  • Select list within interactive report.

    Hello y'all,
    I have a need to develop an interactive report and am lost in how to proceed. I am asking for your help. The report requirements are as such:
    - There are 3 types of records that will be in the report
    - The is a checkbox to associate the records to a particular event.
    - If the record is of a certain value, 3 of the columns in that record have to show as select lists.
    - The records with the other 2 values should not have the select lists, just show a null in those columns.
    - The checkbox must be checked for the select lists to appear.
    - The select lists are based on a list of values. The values are populated with an existing common function used in many of the application pages.
    I am having no success in trying to get the select lists in the report. Has anyone developed an interactive report that uses select lists within the report? Is this even possible?
    I am using application Express 3.2.0.00.27. Any help that you can give is greatly appreciated. Thank you so much!
    *** Got it. It has to be a tabular report with updateable columns. ***
    Edited by: seashell on Sep 13, 2010 5:22 AM
    Edited by: seashell on Sep 13, 2010 7:07 AM

    Hi,
    I am not sure if the "equal to" condition applies to a DOM object... after all, a DOM object can be anything (any HTML element) not only a field.
    Try using a javascript expression instead, like this:
    $v('P6_IR_SELECT_LIST')=='Delete'UPDATE: Sorry, I just tested and "equal to" condition works for DOM objects... should have tested before posting!
    Luis
    Edited by: Luis Cabral on Feb 29, 2012 4:45 PM

Maybe you are looking for