Select box choice resetting

I have a drop-down box that I am using to control the sorting
of my dataset. The drop-down box is located in a spry region
because I want to display different sorting choices depending on a
javascript variable. I have it scripted so that the dataset.sort()
function is called by the drop-down box's onChange handler. It
works great for the sorting - the only problem is that the
drop-down box always reverts back to the first <option> as
soon as the sort() method is called and I would prefer to have it
remain on the last selected index. I know I could probably rig
something complicated in JavaScript involving observer objects and
dynamically building the select options, but before I went down
that road, I was wondering if anyone knew how to get the
<select> box from reverting first?
I attached a quick sample of what I'm talking about below:
<td spry:region="dsPlans" class="SpryHiddenRegion">
<span spry:choose="spry:choose">
<!--- When selected, this select box always resets to
whatever the first option is --->
<select name="sSortBy" spry:when="var1 == 'value1'"
onChange="dsPlans.sort(this.value,'toggle');">
<option value="Field1">Field1</option>
<option value="Field2">Field2</option>
<option value="Field3">Field3</option>
</select>
<select name="sSortBy" spry:when="var1 == 'value2'"
onChange="dsPlans.sort(this.value,'toggle');">
<option value="Field4">Field4</option>
<option value="Field5">Field5</option>
<option value="Field6">Field6</option>
</select>
<select name="sSortBy" spry:default="spry:default"
onChange="dsPlans.sort(this.value,'toggle');">
<option value="Field7">Field7</option>
<option value="Field8">Field8</option>
<option value="Field9">Field9</option>
</select>
</span>
</td>
Any help is greatly appreciated! Thanks!

Hi Michael,
The cleanest way is to use observers as you suggest.
onPreUpdate, store the selected index of the select, and then
onPostUpdate, restore it. Something like:
var savedIndex = 0;
dsPlans.addObserver(function(noticationType, notifier, data)
if (notificationType == "onPreUpdate" &&
document.forms[ 0 ] && document.forms[ 0 ].sSortBy)
savedIndex = document.forms[0].sSortBy.selectedIndex;
else if (notificationType == "onPostUpdate")
document.forms[ 0 ].sSortBy.selectedIndex = savedIndex;
You'd probably also want some logic that resets this
savedIndex whenever your var1 changes too.
--== Kin ==--

Similar Messages

  • How to populate optional items in SELECT BOX

    // REGISTRATION.JSP//
    <%@ page import="java.util.Enumeration" %>
    <%@ page import="java.util.Vector" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.lang.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="beans.register2" %>
    <jsp:useBean id="registerbn" scope= "session" class="beans.register2" />
    <% String base = (String) session.getAttribute("base");
    registerbn.setDburl((String)session.getAttribute("dbUrl"));
    registerbn.setDbuser((String)session.getAttribute("dbUserName"));
    registerbn.setDbpasswd((String)session.getAttribute("dbPassword"));
    System.out.println("Inside jsp - setMembers of promotion successful");
    registerbn.setMembers();
    System.out.println("after setting");
    %>
    <%
    String action=request.getParameter("action");
    %>
    <HTML>
    <HEAD>
    <TITLE> TIFR INTRANET </TITLE>
    </HEAD>
    <HEAD>
    <script language="_JavaScript1.2">
    function isIdcode()
    / validating
    function isUser()
    / validating
    function isEmail()
    / validating
    function isPassword()
    / validating
    function isDob()
    / validating
    </javascript> -----java script ends here----------------
    <TD align="top" valign="top"><jsp:include page="menu.jsp" flush="true"/>
    </td>
    <td>
    <table cellpadding="2" cellspacing="3" width="40%">
    <form method="post" action="./beans.register2">
    Fisrt question: we have creaated "register2.java "as beans class for setting the values in to the data base.
    is it correct ?
    <td width="40" align="center"
    <font face="arial" size="5" align="right">
    <b>
    Registration <hr> </hr>
    </b>
    </font>
    <br>
    </td>
    <tr valign="center" width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">IdCode </b> </font>
    </td>
    <td width="40%">
    <b><font face="Arial" size="2">
    <input type="text" name="idcode" size="6" style="border-style:solid" value="">
    </font></b>
    </td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">User </font></B></td>
    <td width="40%">
    <input type="text" name="user" size="12" style="border-style: solid" value="">
    </font></b></td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Password </font></B></td>
    <td width="40%">
    <input type="password" name="password" size="25" tabindex="20" style="border-style: solid" width="12" value="">
    </font></b></td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Section code </font></b></td>
    <td width="40%">
    <select size="1" name="section_code" tabindex="9"
    style="border-style: solid">
    <%@ include file="section.txt" %>
    Secound question:
    // inclided simple .txt file here
    // what if new item get enlisted in the database , we have to countinuesly update this .txt file ? so we head for creating simple beans class for retriving values
    then displaying in the SELECT box
    // we dont know how to do it.
    //other html tags //
    ----------------at end -----------------
    <input type="Submit" value="Submit" name="B1" > </td>
    <td width="40%">
    <input type="reset" value="Reset" name="B2"></td>
    <%
    String action=request.getParameter("Submit");
    if(action!=null && action.equals("Submit"))
    try{
    String idcode=request.getParameter("idcode");
    String user=request.getParameter("user");
    String password=request.getParameter("password");
    String seccode=request.getParameter("section_code");
    String Category=request.getParameter("Category");
    String BCategory=request.getParameter("BCategory");
    String Bheads=request.getParameter("Bheads");
    String OtherCategory=request.getParameter("OtherCategory");
    String email=request.getParameter("email");
    String day=request.getParameter("day");
    String month=request.getParameter("month");
    String year=request.getParameter("year");
    String Dob=day+"/"+month+"/"+year;
    String day1=request.getParameter("day1");
    String month1=request.getParameter("month1");
    String year1=request.getParameter("year1");
    String Doj=day1+"/"+month1+"/"+year1;
    registerbn.setIdcode("idcode");
    registerbn.setUser("user");
    registerbn.setPassword("password");
    registerbn.setSec_code("seccode");
    registerbn.setCategory("Category");
    registerbn.setBut_Category("BCategory");
    registerbn.setBut_heada("Bheads");
    registerbn.setOther_Category("OtherCategory");
    registerbn.setemail("email");
    registerbn.setDob("Dob");
    registerbn.setDoj("Doj");
    registerbn.saveData();
    /// saveData() is the one method where we are wrintn query to insert in to database//
    }catch(Exception ex)
    out.println("ERROR :has occured ");
    %>
    </table>
    </table>
    </table>
    </form>
    </td>
    </tr>
    <jsp include page="Footer.jsp" flush="true"/>

    To do that you have to get your recordset, and insert option tags into a while cicle. Something like this:
    <select name="mySelectName">
    <%while(myRecordSet.next()){%>
    <option value="<%=myRecordset.getObject(myField1)>"><%=myRecordset.getObject(myField2)%></option>
    <%}%>
    </select>

  • Two select box in a form in JSP...Save me...Please

    Hi,
    My jsp page has one form with two different select/option. One select is fbox and another is tbox. tbox contains master values from db and fbox contanis some/few/no values from db.(It might be empty.) Now, I want to add a value from tbox to fbox. If that value is already in fbox then ALERT otherwise add in that value in fbox. Following is the code for that.
    Would somebody help me out ? I don't know what's wrong with this code. It's not working............It's kind of serious and urgent.
    function add(fbox,tbox) {
    var i = 0;
    if(fbox.value != "") {
    var no = new Option();
    for(var i=0; i < tbox.options.length; i++)
    if((fbox.value == tbox.options.value) || (fbox.value == tbox.options[i].text))
    alert("Value is already added. Select another item.");
    break;
    else
    no.value = fbox.value;
    no.text = fbox.value;
    tbox.options[tbox.options.length] = no;
    fbox.value = "";
    else
    alert("Please enter an item.");

    Hi Srinath or anybody,
    Would u pl. tell me what's wrong with following code ? Javascript prompt is not invoking....U can see/find javascript function addservice(service) in my code which is called by JSP code inside in my form...
    I am using Tomcat 3.3, Jdeveloper 3.2, IE 6.0 and Netscape 7.0.
    I am badly working on this but Javascript prompt is not working....
    Thanks for ur time and help...
    Waiting for ur reply.
    David
    <%@ page contentType="text/html;charset=WINDOWS-1252"%>
    <%@page language= "java" import= "java.sql.*,sun.jdbc.rowset.*,javax.servlet.http.*,java.lang.reflect.*,java.io.*,java.util.*,javax.servlet.*"
    errorPage="error.jsp" %>
    <jsp:useBean id="conn" class="package1.connectionBean" scope="session"/>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1252">
    <META NAME="GENERATOR" CONTENT="Oracle JDeveloper">
    </HEAD><center>
    <BODY>
    <script language="javascript" SRC="FormChek.js"></script>
    <script language="javascript">
    function CheckFstock(ftock) {
    var Gooddigit = "0123456789";
         if (document.formtest.ftock.value.length > 3 )
              alert('Invalid Stock ! Please re-enter with less than equal to 3 digits.');
              return false;
         }// if ends
    function CheckPostal(postal) {
         var valid = 1;
         var GoodChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
         var Gooddigit = "0123456789";
         var Goodextrs = "- ";
         var i = 0;
         if (document.formtest.postal.value == "")
              // Return false if number is empty or length is not 7 length is not 6
              alert('Invalid Postal Code ! Please re-enter now.');
              valid = 0;
    document.formtest.postal.focus();
              return false;
         }//if ends
         else if(document.formtest.postal.value.length == 7)
              //alert (GoodChars.indexOf(document.formtest.postal.value.charAt(0)));
              for (i =0; i <= document.formtest.postal.value.length; i++)
                   //alert( i + "->"+ document.formtest.postal.value.charAt(0))
                   if ((GoodChars.indexOf(document.formtest.postal.value.charAt(0)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(2)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(5)) == -1))
                        alert("Not Valid Chacters in entered Postal Code! Please re-enter now.");
                        valid = 0;
    document.formtest.postal.focus();
                        return false;
                   } // if ends
                   if ((Gooddigit.indexOf(document.formtest.postal.value.charAt(1)) == -1) || (Gooddigit.indexOf(document.formtest.postal.value.charAt(4)) == -1) || (Gooddigit.indexOf(document.formtest.postal.value.charAt(6)) == -1))
                        alert("Not Valid digits in entered Postal Code! Please re-enter now.");
                        valid = 0;
    document.formtest.postal.focus();
                        return false;
                   } // if ends
                   if (Goodextrs.indexOf(document.formtest.postal.value.charAt(3)) == -1)
                        alert("Not Valid extras in entered Postal Code! Please re-enter now.");
                        valid = 0;
    document.formtest.postal.focus();
                        return false;
                   } // if ends
              } // for ends
         }// else if ends
         else if(document.formtest.postal.value.length == 6)
              for (i =0; i <= document.formtest.postal.value.length; i++)
                   if ((GoodChars.indexOf(document.formtest.postal.value.charAt(0)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(2)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(4)) == -1))
                        alert("Not Valid Chacters in entered Postal Code! Please re-enter now.");
                        valid = 0;
    document.formtest.postal.focus();
                        return false;
                   } // if ends
                   if ((Gooddigit.indexOf(document.formtest.postal.value.charAt(1)) == -1) && (Gooddigit.indexOf(document.formtest.postal.value.charAt(3)) == -1) && (Gooddigit.indexOf(document.formtest.postal.value.charAt(5)) == -1))
                        alert("Not Valid digits in entered Postal Code! Please re-enter now.");
                        valid = 0;
    document.formtest.postal.focus();
                        return false;
                   } // if ends
              } // for ends
         }// else if ends
         else { alert('Postalcode is not 7 or 6 charactres long ! Please  re-enter now.');
    document.formtest.postal.focus();
    }//else ends
         return valid
    }//this function ends
    function goback() {
    history.go(-1);
    function addItem(fbox,tbox)
    var boxLength = tbox.length;
    var selectedItem = document.formtest.list1.selectedIndex;
    var selectedText = fbox.options[selectedItem].text;
    var selectedValue =fbox.options[selectedItem].value;
    var j;
    var isNew = true;
    //alert('BOx Length is : ' + boxLength);
    if (boxLength != 0)
    for (j = 0; j < boxLength; j++)
    thisitem = tbox.options[j].text;
    if (thisitem == selectedText)
    isNew = false;
    alert("Selected value is already available. Please select a different item");
    break;
    if (isNew)
    newoption = new Option(selectedText, selectedValue, false, false);
    tbox.options[boxLength] = newoption;
    fbox.selectedIndex=-1;
    function remove(box) {
    if (confirm("Are you sure you want to delete. Continue?")) {
    for(var i=0; i<box.options.length; i++) {
    if(box.options.selected && box.options[i] != "") {
    box.options[i].value = "";
    box.options[i].text = "";
    BumpUp(box);
    function BumpUp(abox) {
    for(var i = 0; i < abox.options.length; i++) {
    if(abox.options[i].value == "") {
    for(var j = i; j < abox.options.length - 1; j++) {
    abox.options[j].value = abox.options[j + 1].value;
    abox.options[j].text = abox.options[j + 1].text;
    var ln = i;
    break;
    if(ln < abox.options.length) {
    abox.options.length -= 1;
    BumpUp(abox);
    function Moveup(dbox) {
    for(var i = 0; i < dbox.options.length; i++) {
    if (dbox.options[i].selected && dbox.options[i] != "" && dbox.options[i] != dbox.options[0]) {
    var tmpval = dbox.options[i].value;
    var tmpval2 = dbox.options[i].text;
    dbox.options[i].value = dbox.options[i - 1].value;
    dbox.options[i].text = dbox.options[i - 1].text
    dbox.options[i-1].value = tmpval;
    dbox.options[i-1].text = tmpval2;
    function Movedown(ebox) {
    for(var i = 0; i < ebox.options.length; i++) {
    if (ebox.options[i].selected && ebox.options[i] != "" && ebox.options[i+1] != ebox.options[ebox.options.length]) {
    var tmpval = ebox.options[i].value;
    var tmpval2 = ebox.options[i].text;
    ebox.options[i].value = ebox.options[i+1].value;
    ebox.options[i].text = ebox.options[i+1].text
    ebox.options[i+1].value = tmpval;
    ebox.options[i+1].text = tmpval2;
    function dosubmit() {
    for ( var i = 0; i < document.formtest.list2.length; i++ )
    document.formtest.list2.item(i).selected = true;
    for ( var i = 0; i < document.formtest.service.length; i++ )
    document.formtest.service.item(i).selected = true;
    function addservice(service) {
    var defaultSelected = true;
    var selected = true;
    //alert('Here');
    var input_box = prompt("Enter some text","");
    //alert(input_box);
    if(input_box != "")
    var optionName = new Option(input_box,input_box,false,false);
    var length = service.length;
    service.options[length] = optionName;
    else
    alert("Service should not be empty ! Write Something.");
    </script>
    <form name="formtest" METHOD="POST" onSubmit="dosubmit()">
    <% String sql;
    sql = "SELECT LINEID, DESCRIP from PURCHVENDOR.AUTOLINE";
    ResultSet results = conn.executeQuery(sql);
    %>
    <TABLE BORDER="1">
    <TR>
    <TD>Code/Type</TD>
    <TD><INPUT TYPE="TEXT" NAME="vcode" SIZE="38">
    <select name="tp">
    <option value="S">Standard</option>
    <option value="A">Aftermarket</option>
    </select>
    </TD>
    </TR>
    <TR>
    <TD>Vendor Name</TD>
    <TD><INPUT TYPE="TEXT" name="vname" SIZE="54"></TD>
    </TR>
    <TR>
    <TD>Contact Name</TD>
    <TD><INPUT TYPE="TEXT" name="cname" SIZE="54"></TD>
    </TR>
    <TR>
    <TD>Address</TD>
    <TD><INPUT TYPE="TEXT" name="address" SIZE="54"></TD>
    </TR>
    <TR>
    <TD>P.O.Box</TD>
    <TD><INPUT TYPE="TEXT" name="POBox" SIZE="54"></TD>
    </TR>
    <TR>
    <TD>City</TD>
    <TD><INPUT TYPE="TEXT" name="city" SIZE="54"></TD>
    </TR>
    <TR>
    <TD>Province/Postal</TD>
    <TD>
    <INPUT TYPE="TEXT" name="province" SIZE="25" onChange="checkStateCode(this)">
    <INPUT TYPE="TEXT" name="postal" SIZE="25" onChange="CheckPostal(this)"></TD>
    </TR>
    <TR>
    <TD>Phone Number</TD>
    <TD><INPUT TYPE="TEXT" NAME="pnumber" SIZE="54" onChange="checkUSPhone(this)"></TD>
    </TR>
    <TR>
    <TD>Fax Number</TD>
    <TD><INPUT TYPE="TEXT" name="fnumber" SIZE="54" onChange="checkUSPhone(this)"></TD>
    </TR>
    <TR>
    <TD>Fee Stock/Factory</TD>
    <TD><INPUT TYPE="TEXT" name="ftock" SIZE="25">
    <INPUT TYPE="TEXT" name="ffactory" SIZE="25">
    </TD>
    </TR>
    <TR>
    <TD>Prefered Vendor</TD>
    <TD><input type="radio" value="1" name="choice" Checked>Yes
    <input type="radio" value="2" name="choice">No
    </TD>
    </TR>
    <TR>
    <TD>Line Carried</TD>
    <TD><select multiple size="5" name="list1" >
    <%
    while(results.next())
    %>
    <OPTION value = "<%= results.getString("lineid")%>"><%= results.getString("lineid")%></OPTION>
    <%
    %>
    </select>
    <input type=button value="Add" onclick = "javascript:addItem(this.form.list1,this.form.list2);"</input>
    <select multiple size="5" name="list2"></select>
    <input type=button value="Delete" onclick = "javascript:remove(this.form.list2);"</input>
    </TD>
    </TR>
    <TR>
    <TD>Service</TD>
    <TD>
    <select multiple size="5" name="service"></select>
    <input type=button value="Add Service" onclick = "addservice(formtest.service);"</input>
    <input type=button value="Delete Service" onclick = "javascript:remove(this.form.service);"</input>
    </TD>
    </TR>
    </TABLE>
    <P><INPUT TYPE="SUBMIT" VALUE="Add" onClick="document.formtest.action='addvpdb.jsp';"</input>
    <INPUT TYPE="SUBMIT" VALUE="Cancel" onClick="document.formtest.action='vendormain.jsp';"</input>
    <!-- <INPUT TYPE="SUBMIT" VALUE="Cancel" onClick= "goback()"</input> -->
    </P>
    </center>
    </form>
    </BODY>
    </HTML>

  • Inserting in table but ADF Select One Choice data is lost

    hi I'm using Jdev 11g
    I've fusion web App
    which handling purchase Invoices
    contains a form for master table purchase
    and a af:table for Invoice detatils table purchase_items
    I'm tring to insert data in af:table detail table which contain ADF Select One Choice. for produc names
    and text box for both cost and quantity and groovy based colum for the amount of (cost * quantity)
    the property auto submit for both columns cost and quantity is set to true
    to update the amount value when user makes any changes on the cost or quantity
    my Problem that
    when I Insert new record and I select value from the product column( Select One Choice )
    and when i type the cost or the quntity I loos the selected value before in the product ( Select One Choice )
    and this is not accebtable for the end user to select the product tow times
    any one could help about this
    thanks

    I'm sorry but it seems it is have solution
    I test it agin with auto submit for cost and quntity set to true
    and still losing data in ADF Select One Choice
    there are no coding used in my App
    and ther are no value on value change listener on cost or quantity
    i think it hapen because i have mandatory fileds like product and cost
    it's firing validation of filed is requierd
    Edited by: user451648 on 11/03/2013 11:58 م

  • ADF Select one Choice not showing Required

    Hello,
    I have a simple ADF page that I have dragged an "ADF Select one choice" field onto. It has an LOV tied to it. I have set the field as required and given a required message to show. The issue is that the field does not show as required when i save the recrod.. and it also does not show any message or turn red. I was able to save the record tgo the database with out the field being filled in.... i assumed since I set the field to required in the property inspector it would not let it store an empty field.
    When I changed this field to an input combo box list of vlaues then it behaved as expected.
    Is this a bug with Jdeveloper ... or just a bug with the developer ( me ) :) .
    I am using 11.1.1.3.o version.
    Thanks for any help in advance.

    Seems to work fine here:
    http://jdevadf.oracle.com/adf-richclient-demo/components/selectOneChoice.jspx
    (change the required properties on the right and click update)
    You can click the view page source to see the code used for that page.

  • Multiple selection box + Substracting cascading dropdown list

    I have a multi-select boxe and a drop down but instead of ADDING the choices made in the multi select box to the list of selectable items in the drop down list, I want to SUBSTRACT them.
    I'll try to clearify it: if in the multi-slection box you have:
    Option A and option B and
    in the drop down list, you (depending on you selection) have 2 4 6 8 (options for A) or 4 8 10 12 (options for B).
    When selecting BOTH A and B, the drop down liast should ONLY display the values that overlap/exist in both A and B (e.g 4 8).
    This would have to work for X number of options in both the multi select box and the drop down list.
    Doess anybody know how to make that work?
    Thanks in advanced and kind regards!

    Hi Little_Ghost,
    for using a form, seems quite a challenge.
    when you select the selection box, or check boxes in the form, you may need to grab the all the selection, and refresh the page with the pre-selected information, so it will be loaded when the page is refreshed.
    if you are using infopath template, it may be difficult, since we need 2 infopath form templates associate with list A and B individually, not sure how to interact this cross 2 infopath form template.
    my infopath colleague suggest you to try to use one infopath form template with 2 data connections.
    i was thinking,
    if you could populate the items, for example by using getlistitem()
    http://spservices.codeplex.com/wikipage?title=GetListItems
    then you may put the result in an array, and ready to compare.
    since you would like to use a form, then it may not updated directly, i am not quite sure for this, because as i know you may need to use a button to send out and update/refresh the fields.
    http://www.quirksmode.org/js/forms.html
    http://www.javaworld.com/article/2077176/scripting-jvm-languages/using-javascript-and-forms.html
    or you may have to try to use the data view webpart:
    http://www.dotnetcurry.com/showarticle.aspx?ID=581
    Regards,
    Aries
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Put adobe as an option in the printer selection box

    how do you place adobe as an option in the printer selection box - when i do online remittances from my bank the remittance sheet only shows a print icon - if you hit it i only have the printer, fax and xps document writer as a selection i am using win7 it used to be in the window of the printer selction when i was using winxp can you solve this for me

    Yes I have acrobat the thing is on the XP there was a selection as save as an PDF File and that was in the Printer Box where u can select the printer you want to use.  But there is no option for this - the reason is again on the bank that I use when you fill out and send your remittance up comes a statement of what you sent date, beneficiary exchange rate etc. you have the option to print this sheet there is no save option on this so when I used hit the printer icon there comes the printer information and on this there was a choice of the printer or save to adobe.  That is missing now and I don't know how to get it back you can only do snip it and save that to the file.
    Can you advise on that?

  • How to do it?? in SELECT BOX

    here is the bean class sample code of getting the result set from
    database
    public void setMembers2()
    String query1="select e.idcode from employee e,wb_login w where e.idcode=w.idcode ";
    stmt1=conn1.createStatement();
    rs1=stmt1.executeQuery(query1);
    System.out.println("Executed query");
    if(rs1.next())
    do{
    id=rs1.getString(1);
    System.out.println("THE IDCODE IS JAVA "+id);
    setId_code(id);
    } while(rs1.next());
    else
    System.out.println("THE IDCODES ");
    here is the sample code in jsp i have to populate the Idcode's in SELECT BOX
    <select name="idcode" size="1" >
    <%
    String str1="";
    promotionbn.setMembers2();
    str1=promotionbn.getId_code();
    System.out.println("THE IDCODE IN JSP PAGE IS "+str1);
    %>
    <option value="<%=str1%>"> <%=str1%>
    </select>
    But in the select box priniting only one record.........

    Hey,
    Where are u defining the get/set methods method ??. The code u gave is not very clear. Acording to what u gave below it will surely print only one record probably the last one.
    KM
    here is the bean class sample code of getting the
    result set from
    database
    public void setMembers2()
    String query1="select e.idcode from employee
    e,wb_login w where e.idcode=w.idcode ";
    stmt1=conn1.createStatement();
    rs1=stmt1.executeQuery(query1);
    System.out.println("Executed query");
    if(rs1.next())
    do{
    id=rs1.getString(1);
    System.out.println("THE IDCODE IS JAVA
    CODE IS JAVA "+id);
    setId_code(id);
    } while(rs1.next());
    else
    System.out.println("THE IDCODES ");
    here is the sample code in jsp i have to populate the
    Idcode's in SELECT BOX
    <select name="idcode" size="1" >
    <%
    String str1="";
    promotionbn.setMembers2();
    str1=promotionbn.getId_code();
    System.out.println("THE IDCODE IN JSP PAGE IS
    "+str1);
    %>
    <option value="<%=str1%>"> <%=str1%>
    </select>
    But in the select box priniting only one
    record.........

  • The html select box option is not getting displayed properly in IE11

    The html select box option is not getting displayed properly in IE11
    I have developed a website that has a select box drop down. The select box drop down is getting displayed properly in IE9. But in IE11, if I am selecting any option apart from the first one, the whole select box option is getting moved up in the page.
    In IE11, if option 2 is selected, then the select options is getting moved up. But in IE9, if option 2 is selected, then the select options is getting displayed properly.
    Please let me know the fix so that the select options are displayed in the same manner as in IE9.
    Sorry but I am unable to upload images as this site is throwing some error

    Hi Kevin Shen,
    Thanks for post.
    I tried above code in ie 11(version 11.0.9600.17633).
    But it is not working. If you select option 2, and open select box then it open on the select box.
    It should open below the select box.
    Code for above:-
    <select>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    </select>
    Sorry I could not attach screen shot. We have normal select box with three options. If we select option 2, it is showing option list on the select box. It is coming below the select box in ie 10 and other browse like chrome. 
    So what we should do, so that all options will come below the select box?
    Thanks,
    Yogesh Toke

  • Multi-Select Box Not Displaying Values Passed From Grid?

    Coldfusion 8
    I inherited an application and am trying to maintain and improve it... hit a snag today.
    I have a multi-select box that is not displaying what I expect.  The values come from a ColdFusion grid which is based off a database query.
    Here is the code for the select - does not work - nothing is selected:
    <cfselect name="USER_IDS" multiple="true" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
    </cfselect>
    Now if I change the multiselect to a single select like below - it takes the first item in the field list (from the grid) and selects it in the drop down.
    <cfselect name="USER_IDS" multiple="false" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
    </cfselect>
    Or if I assign a variable like this and use the multi-select code it seems to work as well.
    testlist = "22,26";
    <cfselect name="USER_IDS" multiple="true" queryposition="below" selected="#testlist#" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
    </cfselect>
    I have displayed the value of "User_IDs" in the grid and in the data entry part of the screen to see values of:  22,26
    to make sure that wasn't my issue.
    Do grids and multiselects require something additional?  Any advice on how to resolve?

    Problem was related to some javascript for the select box.  There was a function for a single select box but not a multiple select box - this fixed it: 
    if(theForm.elements[i].type == "select-multiple"){
                        var selectBox = theForm.elements[i];
                        var sbname = selectBox.name;
                        cpvalue = String(eval('record.data.' + sbname));
                        var NotifyArray = cpvalue.split(',');
                        for (var j=0; j < selectBox.length; j++) {
                            selectBox[j].selected = false;
                        for (var j=0; j < selectBox.length; j++) {
                            sbvalue = selectBox[j].value;
                            for (var k=0; k < NotifyArray.length; k++){
                                if (sbvalue == NotifyArray[k]){
                                    selectBox[j].selected = true;

  • Text input in a Select One Choice Component

    Is there a simple way to enable text input in a Select One Choice Component or do I need to use an LOV or other component to provide that functionality?

    You should only use LOV.

  • How to get selected values from Select Many Choice List

    Hello All -
    I am using Select Many Choice List and wish to get the selected values in the bean. I have created method binding for valueChangeListener for the choice list, but not sure how to get the selected values.
    I am facing problem in getting values from valueChangeEvent.getNewValue(). For Select One Choice List this returns int, but some list type object for Select Many Choice List.
    When I try to print the value it comes something like:
    ArrayList newVal = new ArrayList(Arrays.asList(valueChangeEvent.getNewValue()));
    System.out.println(newVal);
    [Ljava.lang.Integer;@870ad8
    Could anyone please suggest how to type cast and use the return of valueChangeEvent.getNewValue() to get the selected values.
    Regards -
    Rohit

    Hi Timo -
    Thanks for the suggestion. I could get the values as below:
    public void multiOpUnitValChange(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding opUnitIter = (DCIteratorBinding)bindings.get("OperatingUnit2VOIterator");
    Integer[] values = (Integer[])valueChangeEvent.getNewValue();
    for (int i=0; i<values.length; i++){
    Row row = opUnitIter.getRowAtRangeIndex(i);
    System.out.println(row.getAttribute("OpUnitId"));
    Thanks -
    Rohit

  • How to get a value from  select one choice (created by static view)

    Hi,
    Whene ever Iam trying to get value from select one choice which is created by static view iam getting only index.How to get the actual value in 11g .please help me anybody .Thanx in advance....
    Edited by: 874530 on Jul 22, 2011 11:05 PM

    Thnax for your quick reply..
    Iam using 11.1.1.3.0 version.
    My code is
    <af:selectOneChoice value="#{bindings.DenialLevel.inputValue}"
    label="#{bindings.DenialLevel.label}"
    required="#{bindings.DenialLevel.hints.mandatory}"
    shortDesc="#{bindings.DenialLevel.hints.tooltip}"
    id="soc2"
    valuePassThru="true"
    binding="#{backing_denialcomment.denialLevelList}">
    <f:selectItems value="#{bindings.DenialLevel.items}" id="si6"/>
    </af:selectOneChoice>
    and in bean am not able to get value of attribute .Iam getting only index...

  • Get selected value from a select one choice in the bean

    I'm trying to do with the SelectOneChoice valueChangeListener and this is the code of my method, I'm using jdeveloper11g if alguin can help as I need the value you selected in the bean
    public void cambioCombo(ValueChangeEvent valueChangeEvent) {
    CoreSelectOneChoice csoc = (CoreSelectOneChoice) valueChangeEvent.getSource();
    List childList = csoc.getChildren();
    for (int i = 0; i < childList.size(); i++) {
    if (childList.get(i) instanceof CoreSelectItem){
    CoreSelectItem csi = (CoreSelectItem) childList.get(i);
    if (((String)csi.getValue()).equals((String) valueChangeEvent.getNewValue()) ){
    System.out.println("------------>"+csi.getLabel());
    I get the following error when running the application and selecting in my select one choice
    oracle.adf.view.rich.component.rich.input.RichSelectOneChoice cannot be cast to org.apache.myfaces.trinidad.component.core.input.CoreSelectOneChoice

    This is an example of some code that i wrote.
    public void changeDesc(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    System.out.println("value "+ valueChangeEvent.getNewValue().toString());
    //System.out.println("old value "+ valueChangeEvent.getOldValue().toString());
    if (valueChangeEvent.getNewValue().toString().equals("Area Uno")){
    this.descripcion.setValue("RR.HH");
    } else {
    this.descripcion.setValue("Finanzas");
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.descripcion);
    For get the Value select in the "SelectOneChice" component i use this: valueChangeEvent.getNewValue().toString()
    cheers

  • Building a select box multiple times on one page.

    Hello,
    I have a ResultSet rsAgencies that contains all of the information needed to create the options for the agencies select box. It works something like this:
    <select name="selAgencyId" id="selAgencyId" class="Standard">
         <option value="-1" selected>Select One</option>
         <% while (rsAgencies.next()){ %>
              <option value="<%= rsAgencies.getInt("id") %>"><%= rsAgencies.getString("name") %></option>
         <%}%>
    </select>Pretty straight forward. But I need to print these same options out in several different select boxes on the same page and can't figure out how to encapulate this functionality in order to do it.
    In ASP, I would have simply had a function declared on this page that I would pass the ResultSet to. It would loop through the rs and build the options.
    But JSP won't let me declare a function (or maybe I just don't have the syntax right).
    I have also tried putting it in a bean and calling that function from the JSP, but it kindof skips over it for some reason.
    If anyone has done this and can give me a nudge toward the best practice, I would be forever grateful.
    Thanks
    James.

    Limey,
    Thanks. I did not know that about the declaration tags.
    Yes, I decided to build a function that accepts a resultset and returns a vector. It allows me to minimize trips to the database as well as loop through multiple times.
    I ended up putting that function in a bean that will hold all of my common functions for the application. I assume that is a pretty fairly standard way of sharing functionality from page to page.
    Thanks again.
    James.

Maybe you are looking for

  • How to remove duplicates while joining two query results ?

    Hi all, Please, anyone suggest me how to do below one.. i am using oracle version 11.2.0.3.0 Col_1 Col_2 111 AAA AAA 111 222 BBB 333 CCC As, oracle point of view the above table contains distinct rows. But i need the logic result like below, Col_1 Co

  • ITunes stalls with no reason

    Hi all. I'm not sure it's my computer there is something wrong with, but for as long as I have used iTunes, the startop can take up to 30 sec, before the program launches. There are other instances where it feels like it's just stopps, and my entire

  • STO deliveries

    In a STO with delivery scenario, I have a problem. VL10B for sales order should not consider stock in quality VL10B for purchase order STO (UB) should take stock in quality. So, for purchase orders, I defined a new checking rule "ZM" for the checking

  • Archive currupted

    [flyer@athlon ~]$ pacman -Scc Password: Do you want to remove all packages from cache? [Y/n] y removing all packages from cache... done. [flyer@athlon ~]$ pacman -Syu Password: :: Synchronizing package databases... core is up to date extra is up to d

  • Need help for jdbc..

    hi everyone, when connecting GUI to javaDB, i can insert data in table of one database, but in same way, when i try to insert data in table of another database, it gives error that 'table' doesn't exist. All other things are same, but even if i only