Getting multiple values from a list box

Hi,
I am not able to get multiple selected values from a list box using the getParameterValues(). I used the following code..
String[] names=request.getParameterValues("lname");
can anyone tell me what the error is or is there any other way i can get multiple selected values from a list box.
Thanks
Satish

Fragment 1
This is the JSP Code am using for testing
<%
String[] name =request.getParameterValues("D1");
if(name.length==1)
String value=name[0];
Instead of name.lenght==1 try with name!=null
Fragment 2
out.println(value);
replace the above fragment with
%>
   <%-- print result -->
   <%=name[0]%>
<%
Fragment 3
else
%>
The list box D1 is a multiple select list box.
If it still doesn't work, check that the checkboxes have the same name as well as different values
<input type="checkbox" name="D1" value="1">
<input type="checkbox" name="D1" value="2">I hope this helps :-)
Good luck
touco
ps: i want duke

Similar Messages

  • How to get multiple values from the list

    I've a list of an item which I queried it from the database. I also created a button that will takes a selected items from the list when it was clicked. I used javabean to get the data from database.
    <%     // clicked on Select District Button
    Vector vselectedDistrict = new Vector();
    Vector vdistrictID = new Vector();
    String tmpSelectDistrict = "";
    tmpSelectDistrict = request.getParameter("bSelectDistrict");
    if(tmpSelectDistrict != null)
         // get multiple values from the list
         String[] selectedDistrict = request.getParameterValues("usrTDistrict");
         vselectedDistrict.clear();
         vdistrictID.clear();
         if((selectedDistrict != null) && (selectedDistrict.length != 0))
                             for(int i=0;i<selectedDistrict.length;i++)
                   vselectedDistrict.addElement(selectedDistrict);           
              vdistrictID = dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
              for(int i=0;i<vdistrictID.size();i++)
                   out.println("district = " + selectedDistrict[i]);                         out.println("district ID= " + vdistrictID.get(i).toString());
    %>
    // get vdistrict from the database here......
    <select name="usrTDistrict" size="5" multiple>
    <%     for(int i = 0; i< vdistrict.size(); i++)
    %>
         <option value="<%=vdistrict.get(i).toString()%>"><%=vdistrict.get(i).toString()%></option>
    <%
    %>          
    </select>
    <input type="submit" name="bSelectDistrict" value="Select District">
    Lets say the item that i selected from the list is 'Xplace' and I clicked on the Select District button,
    what I got is this error message:
    org.apache.jasper.JasperException: Unable to convert string 'Xplace' to class java.util.Vector for attribute usrTDistrict: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
    So where is going wrong and what the message means?. Any help very much appreciated. Thanks

    These are just guesses that might hopefully steer you in directions you haven't looked in yet.
    I presume you used triangle brackets (< >) to avoid having the Jive Forum think it was the "italics" tag?
    Are you certain this: dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
    expects a Vector as its second parameter? And returns a Vector?
    I don't believe you've shown how you use the javabean, or its code? Perhaps it should be rewritten to accept an array of strings instead of a Vector?

  • Return multiple values from a list box

    hi I have a listBox (<mx:List>) that is populated by a
    webService acting as its dataProvider ("myDataProvider")......
    within the listBox the value shown from the dataProvider is
    the "customerName", there is also a customerID values within the
    dataProvider.
    I have set the "allowMultipleSelection" equal to true so that
    more than one row / value can be selected.
    I want to retrieve all of the ID (customerID) valause from
    all of the selected rows within the listBox.
    if I use the following:
    var myObj:Object = new Object;
    myObj.id = myListt.selectedItem.CUSTOMERID;
    it works - but only returns 1 single ID value (the first
    selected etc) when I change "selectedItem" to "selectedItems" it
    does not return anything:
    var myObj:Object = new Object;
    myObj.id = myListt.selectedItems.CUSTOMERID;
    can anyone help me out here.... ?
    thanks,
    Jon.

    Thanks. I forgot to post the answer. I did use an Array, but
    since I needed a string of IDs only, I had to loop through the
    Array to build the comma-sep string.
    public function mySelections():void
    var loopList:String = "";
    var selectedLoops:Array = patchedLoops.selectedItems;
    for ( var i:int; i < selectedLoops.length; i ++) {
    loopList = loopList + selectedLoops
    .CategoryID + ",";
    si.text = loopList;
    This worked great, but before I could submit to the database
    I had to strip off the trailing comma in my CFC.
    <cfset str_patchedloops = Left(str,Len(str)-1)
    >

  • How to get actual value from LOV list

    Like Subject says: How to get actual value from LOV list. Any help will be appreciated.
    Thanks.

    Thanks Shay, I did it with bind variable because I'm not using JSF. Is there any chance to post solution using standard JSTL or HTML expression. I have something like this: LOV displays some Companies names:
    <html:select property="UserJobCompanyId"
                             disabled="${!bindings[\'UserJobCompanyId\'].updateable}"
                             onchange="submitform();">
                  <html:optionsCollection label="prompt" value="index" property="UserJobCompanyId.displayData"/>                                                     
                </html:select>and I want to get CompanyID of selected Company.
    Thanks, again.

  • After selecting the value from the list box, want to disable checkbox

    hi guru,
    After selecting the value from the list box, want to disable checkbox and custom control textbox(container) in module pool.
    so please help me on this.
    thanx,
    man

    in PBO,
    loop at screen.
      if screen-name = your textbox's name.
        screen-input = 0.
        modify screen.
      endif.
    endloop.

  • How to get the value from select list to text box

    Hi,
    I have a select list i want to retrieve the value from select list to text box.
    How can i do that???
    Regards,
    Sakthi.

    Hi Sakthi,
    Yo can use the Java script for that..
    Dynamically the value will come into text box.
    Use the below script.
    <script type="text/javascript">
    function disFormItems()
    var lReturn = $v(here your select list name)
    alert(lReturn);
    document.getElementById(here your text box name).value =lReturn; }
    </script>Cheers,
    Shan

  • Getting multiple values from a report

    I created a report in portal and I can get a single value using "get_value" function. Which procedure or function do I need to use to get multiple values ?
    Any help on this is greately appreciated.
    Ajay

    Fragment 1
    This is the JSP Code am using for testing
    <%
    String[] name =request.getParameterValues("D1");
    if(name.length==1)
    String value=name[0];
    Instead of name.lenght==1 try with name!=null
    Fragment 2
    out.println(value);
    replace the above fragment with
    %>
       <%-- print result -->
       <%=name[0]%>
    <%
    Fragment 3
    else
    %>
    The list box D1 is a multiple select list box.
    If it still doesn't work, check that the checkboxes have the same name as well as different values
    <input type="checkbox" name="D1" value="1">
    <input type="checkbox" name="D1" value="2">I hope this helps :-)
    Good luck
    touco
    ps: i want duke

  • RE: Getting multiple values from more than one multiple select popup window

    I have a button on a JSP of mine that when clicked creates a popup window (right now it is called popup.html) with a multiple select menu.
    My question is how do I get all the values selected from the menu into my JSP (sample.jsp) so that I can set each of the values for my bean.
    The other problem is that I have more than one select multiple menu.
    Please help if you can. Any advice or suggestions here would be greatly appreciated!
    Thank you!

    I realize that I can use request.getParameterValues to get the values selected from my html because I am passing them to the hidden inputs I have and then using the request.getParameterValues to get each of the values.
    MY PROBLEM IS WHAT IF I HAVE 4 MULTIPLE SELECTS??? How can I use the same html popup menu to get the values from the 4 different multiple selects????
    I look forward to your response.
    This code is from my JSP:
    <INPUT TYPE="TEXT" NAME="Field1" SIZE="15">
    <INPUT TYPE="hidden" name="F1Rad1">
    <INPUT TYPE="hidden" name="Permission">
    <input type=button name=choice onClick="window.open('optionPicker.html','popuppage','width=250,height=100');" value="Options"></TD>
    Here is my optionPicker.html code for the pop up menu:
    <html>
    <head>
    <script language="JavaScript">
    function sendValue(s)
    var boxSize= s.options[0].value;
    var restrict     = s.options[1].value;
    window.opener.document.addNewForm.F1Rad1.value = boxSize;
    window.opener.document.addNewForm.Permission.value = restrict;
    window.close();
    </script>
    </head>
    <body>
    <center>
    <form name=selectform>
    <select multiple name=selectmenu size="2">
    <option value="large">Large Text Input Area
    <option value="restrict">Restricted Access
    </select>
    <p></p>
    <input type=button value="Select Option(s) For Field" onClick="sendValue(this.form.selectmenu);">
    </form>
    </center>
    </body>
    </html>

  • Select multiple items from a list box as values for a parameter of crystal report and Oracle procedure

    -  I have a  Product list box (asp.net) used as multiple selected values for  a parameter. 
    - The Product ID is defined in the Oracle procedure as NUMBER data type. 
    -  In my crystal report, I have a parameter field allow multiple values as p_product_id type as Number.  This is the code in my Record Selection Formula for the report:
    ({?p_product_id}[1] = -1 OR {Procedure_name.product_id} in {p_product_id})
    -  In C#, this is my code
    List<decimal?> productUnit = new List<decimal?>();
    int counter = 0;
    decimal prod;
    for (int i = 0; i < lstProducts.Items.Count; i++)
                  if (lstProducts.Items[i].Selected)
                                if (decimal.TryParse(lstProduct.Items[i].Value, out prod))
                                    productUnit.Add((decimal?)prod);                              
                                    counter++;
           if (counter == 0)
                       productUnit.Add(-1);                      
    ReportingDAO rDataFactory = new ReportingDAO();
    retVal = rDataFactory.GetProductReport(productUnit);
    public CrystalDecisions.CrystalReports.Engine.ReportDocument GetProductReport(List<decimal?> productUnit)
              CrystalDecisions.CrystalReports.Engine.ReportDocument retVal = new rptProductDownload();
              ReportLogon rptLog = new ReportLogon();
             rptLog.Logon(retVal, "RPT_PRODUCT_DOWNLOAD");
             retVal.SetParameterValue("p_product_id", productUnit); 
    I keep having the "Value does not fall within the expected range" when I debug.  My question is, is the data type I used for procedure/Crystal report/ and C# correct ?  I always have problem with the data type.  Any help would be
    appreciated
    Thank you

    Hi progGirl,
    Thank you for your post, but Microsoft doesn't provide support for CrystalReport now. Please post your question in SAP official site here:
    http://forums.sdn.sap.com/forum.jspa?forumID=313
    Thank you for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Displayin multiple values from a LIST using useBean

    Hi,
    I want to display certain values in a drop-down box that are retrieved from a getter method in a bean.
    First of all... Is this possible? if so please help... in dire need to know situation...
    any alternative way help is also welcome.....

    Fragment 1
    This is the JSP Code am using for testing
    <%
    String[] name =request.getParameterValues("D1");
    if(name.length==1)
    String value=name[0];
    Instead of name.lenght==1 try with name!=null
    Fragment 2
    out.println(value);
    replace the above fragment with
    %>
       <%-- print result -->
       <%=name[0]%>
    <%
    Fragment 3
    else
    %>
    The list box D1 is a multiple select list box.
    If it still doesn't work, check that the checkboxes have the same name as well as different values
    <input type="checkbox" name="D1" value="1">
    <input type="checkbox" name="D1" value="2">I hope this helps :-)
    Good luck
    touco
    ps: i want duke

  • Problem in getting selected values from multiselect list

    Hi,
    I have two multiselect listboxes in my page. In List1 the data will be retrieved from DB and listed.I will have buttons to move the values from List1 to List2 and viceversa.
    After selecting the needed values,I can rearrange them in List2 using some buttons. I have coded this moving and reordering using javascript.
    What happens is while submitting the page I want the values from list2 which are rearranged. But im getting the order in which I moved from list1 to list2.
    I am using html:selectfor both lists
    List1
    <html:select name="CustForm" property="custName" multiple="true" size="10">
           <html optionsCollection property="CustomerNames" value="custName" label="id"/>
    </html:select>I am having a customer form which has a arraylist CustomerNames. This arraylist has customer bean which has proeprties custName and id. The custForm also has a String custName.
    List2
    <html:select name="CustForm" property="selectedCustName" multiple="true" size="10">
           <html  option value=""/>
    </html:select> The custForm also has a String[] selectedCustNames from where I get the selected values in list2
    Please let me know what am I doing wrong here.

    use a treeSelectionListener, that will give you all the selection changes you need.
    thomas

  • Multiple value selection in List Box

    Hi Experts,
    In the selection screen of a report program, I have created a list box for countries as below:
    PARAMETERS p_contry TYPE zcountry AS LISTBOX VISIBLE LENGTH 20 OBLIGATORY. " Country
    While executing, I want to select multiple countries using CTRL key. is it possible if so then I can get it.
    Thanks
    Deep.

    Try with something like this:
    select-options s_contry for <your table name>-<field name > NO-INTERVALS.
    In the selection screen, you can see a button next to the select-option.
    If you click on that, you can enter multiple values, ranges, and values to exclude or ranges to exclude.
    Regards,
    ravi

  • ADF  Get selected values from Dynamic Lists

    Hi,
    I have a created a dropdown list box where the list gets value through a managed bean. On commit I want the selected value to be saved into the CardiacV1EchoSched column of the Entity object (database). The source looks like this.
    <af:selectOneChoice value="#{bindings.CardiacV1EchoSched.inputValue}"
    label="#{bindings.CardiacV1EchoSched.label}"
    valuePassThru="true">
    <f:selectItems value="#{TTrack.carScheList}"/>
    </af:selectOneChoice>
    The problem is that getCardiacV1EchoSched() in the entity object class is null. The selected value does not get passed into #{bindings.CardiacV1EchoSched.inputValue} at all. If I bind the value to a variable in managed bean I get the selected value.
    Thanks in advance,

    Hi,
    not sure which business service you use to update the database, but if you use ADF Business Components then you need to call the commit operation
    Frank

  • Assigning multiple values from a List of Values at detail (table) level

    Hi,
    I have a master detail entry screen. I want to assign multiple values when end user selects an item from the list. The field is at detail level (Table type). I can do it using the "Select one choice" type component (ADF Faces Core) but it doesnt retain the value when I go to the next record. This type of component works fine with the screen with only one record to show (form type). This component has binding with list type.
    If I use simple list with Table binding, I can not assign values to multiple items. This type of list retains value when record is changed.
    Can anyone help me resolving this issue?
    Thanks,
    CAH

    Post on Jdev forum JDeveloper and OC4J 11g Technology Preview
    --Shiv                                                                                                                                                                               

  • How to get total value from checkbox list?

    I have a list of checkbox items - all number values. I want to then get the total value from all of the check items and add that value to the database. Can this be done?
    Also, anyone know of one source where I can get detailed information on how to best use Web Apps and all of it's possibilities and limitations? Most of the tutorials that I have seen so far say that you can do most anything with Web Apps; however, the tutorial examples leave a lot of questions unanswered. I saw that Adobe has an article that shows how to build a basic web app and that it is "part 1" in a series. Anyone know where to find parts 2, 3, etc?
    Thanks,

    Hi there,
    Good day, i hope this will give you some ideas
    for example this is your html
    <input type="checkbox" name="test" value="1">1
    <input type="checkbox" name="test" value="2">2
    <input type="checkbox" name="test" value="3">3
    <input type="checkbox" name="test" value="4">4
    and this is your jquery script
    <script type="text/javascript">
    jQuery("input@[name='test']").click(function() {
        var istrue = jQuery(this).is(":checked");
        if(istrue == true) {
            var urvalue = jQuery(this).val();
            alert(urvalue);
    </script>
    hope this helps you

Maybe you are looking for