HELP in Select box

Hi all,
I have 3 select boxes in a single JSP page.Like
First Select box
<select name="animal>
<option>Cat</option>
     <option>Dog</option>
     <option>Donkey</option>
     <option>Monkey</option>
     </select>
Second select box
     <select name="animal>
<option>Dog</option>
     <option>Donkey</option>
     <option>Monkey</option>
     <option>Cat</option>
     </select>
Third Select box
     <select name="animal>
<option>Donkey</option>
     <option>Monkey</option>
     <option>Cat</option>
     <option>Dog</option>
</select>
I have the requirement like the options has to come like the above.
Is any any ways to do it

Hello all
I got the solution ie ineach select box i have to forcibly make selected
<html>
<select name="a">
<option value="1" selected>1</option>
<option value="1">2</option>
<option value="1">3</option>
</select>
<select name="a">
<option>1</option>
<option selected>2</option>
<option>3</option>
</select>
<select name="a">
<option>1</option>
<option>2</option>
<option selected>3</option>
</select>
</html>

Similar Messages

  • Need help with moving items betwen 2 netui select boxes

    Hi,
    I have 2 multiple select boxes for possible courses and assigned courses. I need a way to implement move of option items from one box to another using buttons. The user can select courses from one box and move them to another. I am not sure how I would do that with netui select boxes and a pageflow method. If I use javascript, i get all kinds of errors even though I am trying to use the tagid. If validation fails, then the select boxes dont save the updated content.
    Please help.
    Bindu

    Ahmed_Arafa wrote:
    hii all,
    i have a list item.. in this list item i have a two list item value
    1- visa ,list elements visa
    2- cash ,list elements cash
    i need when user select visa from list item then appear text item (visa_number)
    i change item visa_number visible to no
    that's my code i write it
    trigger
    when new-block-instance
    IF :RESERVATION.PAY_METHOD = 'visa'THEN
         SET_ITEM_PROPERTY('RESERVATION.VISA_NUMBER',VISIBLE,PROPERTY_TRUE);
    ELSE
    SET_ITEM_PROPERTY('RESERVATION.VISA_NUMBER',VISIBLE,PROPERTY_FALSE);     
    END IF;**My problem is when i click on cash in the first nothing happen and this right
    when i click to visa second nothing happen this not right
    **when i click on visa first every thing is working
    i need when i click on visa any time item appear and when i would like to click to cash.. visa item is disappearWrite your code in When-List-Change trigger at list_item.
    Hope this will help you.

  • Help with building a select box from a query?

    New thread from a topic I started yesterday. From the responses, and a search of other threads, I realized that I was way off base:-) So, I went back and verified that my TomCat setup was alright. After a few tweeks I verified that I could display the index page and successfully run all of the example servlets and jsps. I then built a simple login.jsp and an associated bean to verify a user id and password on an ldap db. That works good. Next, I built a bean which runs a query against the same ldap db and returns a list of last names. What I want to do is use the last names in the bean to populate my select box. At first I was trying to build the html with the list from my bean, i quickly realized you guys didn't like that approach. So, can someone explain, in some detail (because I'm really dense), just how I can return the values from my bean and build a select box with those values.
    regards,
    Mat
    BTW Gone to see Lord of The Rings...back in about 5 hours :-)

    Just in general, I prefer knowing how to do things the "old-fashioned way" first before using other tools, because if it comes time for you to take over someone else's code, you'll probably find that they did it the old way and you'll want to understand that. Further, the new ways are based on the old ways for many things.
    Struts is a good system, but unless you have some understanding of the basics, it's probably going to be harder to understand it. If you have the time, I'd say at least go thru one book on JSP/servlets (which should be all about the basics, maybe a slightly older book) and go thru the examples in it.

  • How disable smartcut  section select box? Wayne help needed!

    Dear friends
    I disable smartcut section select box with Toolbar=Navigation parameter in link
    http://localhost:45000/workspace/browse/get/KursHYP2008/siyavus/BimR.bqy&user=admin&pass=password&Toolbar=Navigation
    but when I login in LoginDash and activate another section, the section select box is activated on menu again!
    regards

    Can you be a little more descriptive on what you need here and explain what exactly you want to be changed.

  • Help with a Custom JSP - Select Box (entry view definition).

    I'm in no way an expert in HTML so please bear with me. We have quite a large list of Job Titles that we use on multiple forms and I wanted to use a custom jsp so I only have to update our title list once if we add/remove titles at our organization. I created a simple select box with all our titles and put them on the Vibe server under the custom jsp folder. The select box shows up on the entry form definition no problem... I just don't know how to make it show up on the entry view definition. The code is obviously pretty basic:
    <html>
    <select name ="Title">
    <option value ="Title1">Title1</option>
    <option value ="Title2">Title2</option>
    <option value ="Title3">Title3</option>
    <option value="Title4">Title4</option>
    </select>
    </html>
    What do I need to do in order for it to show up on the entry view definition side of things? Could anyone with html and/or Vibe knowledge please chime in? I'd really appreciate it.

    Try the following custom JSP, it works fine in my environment.
    Construction is a s I said before: while in edit mode (add or modify) it appears as Select Box, otherwise gives the value only.
    Regards, Darek
    <%@ include file="/WEB-INF/jsp/definition_elements/init.jsp" %>
    <c:choose>
    <c:when test='${ssOperation == "add_folder_entry" || ssOperation=="modify_folder_entry"}'>
    ${property_caption}<br>
    <select name="${property_name}">
    <option value="opt1">title1 1</option>
    <option value="opt2">title 2</option>
    <option value="opt3">title 3</option>
    <option value="opt4">title 4</option>
    </select>
    </c:when>
    <c:otherwise>
    ${ssDefinitionEntry.customAttributes[property_name]}
    </c:otherwise>
    </c:choose>

  • How can I see the numbers of lines selected in a Multiple Selection Box?

    Hi everybody,
    what I want to do is to get in an array of numbers all the lines selected.
    For instance, if I select the rows 1,4 and 7 from a Multiple Selection Box
    of 10 rows in total, how can I see that array when the rows 1,4 and 7 are
    selected?
    Because I want to connect this numbers to Case Structure and if the only
    rows selected are 1,4 and 7, the Case Structure will only realize this cases,
    and the rest will be ignored.
    I'm sure there is some way to get what I want.
    Thank you for your helpful.

    THANK YOU VERY MUCH. IT WORKS PERFECTLY!!!
    "Dennis Knutson" wrote:
    >>If you just wire the list box to an array indicator, you will see that
    the>output is an array of the selected items. Auto index the array through
    a>for loop that has your case statement inside.>>Dennis Knutson>>"Carlos
    Jorge" wrote>>Hi everybody,>>what I want to do is to
    get in an array of numbers all the>lines selected.>For instance, if I select
    the rows 1,4 and 7 from a Multiple>Selection Box>of 10 rows in total, how
    can I see that array when the rows>1,4 and 7 are>selected?>>Because I want
    to connect this numbers to Case Structure>and if the only>rows selected are
    1,4 and 7, the Case Structure will only>realize this cases,>and
    the rest
    will be ignored.>>I'm sure there is some>way to get what I want.>>Thank you
    for your helpful.>>

  • How to Populate values dynamically in Select Box.

    Hi All,
    I have few select boxes in my webdynpro application. Right now I am populating them using Harcoded values in the Dictionary. But I dont want to harcode the values in the dictionary, i want pull the values from database tables or  text files of EP KM. Just let me know which is the better way to populate the select box without hardcoding & why ?
    Thanks in Advance.
    Regards,
    Aditya Metukul

    Hi Aditya,
    Getting values from KM and database is possible
    It depends on your requirement
    ie if the dropdown should contain details of documents from KM or it should display the details in a table
    if it is oracle table see this link
    Webdynpro and Oracle
    if you want to get data from km see this tutorial
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on using knowledge management functions in web dynpro - 26.htm
    Hope this helps you
    Regards
    Rohit
    Regards
    Rohit

  • How to populate select boxes in custom work flows?

    We are trying to create a workflow that allows users to select a few item details from a select box inside the form. I created the select box but I can't figure out how to populate it with elements. I've been reluctant to post here because this question seems so straight forward but I haven't been able to find the answer and don't want waste more time searching for this answer. Please help!
    Thanks,
    Richard

    Sorry for the trouble, I found the answer. I was looking in all the wrong places. Thanks anyway!
    Richard

  • Add form fields dynamically onchange of a select box.

    I have a JSP page with a <h:form>:
    <h:form id="registrationForm">
         <h:outputText value="#{Resource.EmailAddress}" /><br />
         <h:inputText label="E-mail Address" id="emailAddress" value="#{RegistrationBean.emailAddress}" required="true" requiredMessage="#{Resource.RequiredError}">
              <f:validator validatorId="EmailValidator" />
         </h:inputText><br />
         <h:message for="emailAddress" styleClass="error" /></td>
         Select age range<br />
         <h:selectOneMenu id="ageRange" value="#{RegistrationBean.ageRange}" valueChangeListener="#{RegistrationBean.updateComponents}" onchange="javascript: return submit()">
              <f:selectItems value="#{RegistrationBean.ageRangeValues}" />
         </h:selectOneMenu><br />
         <h:commandButton id="submit" value="#{Resource.Submit}" />
    </h:form>When the user changes the value for the ageRange select box, the form gets submitted through the following JavaScript:
    function submit() {
         document.forms[0].submit();
         return true;
    }Then the ValueChangeListener defined in a backing bean for the ageRange select box gets called:
    public void updateComponents(ValueChangeEvent e) {
         // Generate components automatically
    }What I want is, when the user changes the value of the ageRange select box, the valueChangeListener should generate a few new text fields in the form and the validator for the e-mail address field shouldn't get called. The validator for the email-address field should only get called once the user clicks on the Submit button.
    Any help or pointers will be greatly appreciated.

    You can find here lot of pointers: http://balusc.blogspot.com/2007/10/populate-child-menus.html

  • Multiple Select boxes in one form

    Does anyone know if it is possible to have multiple select
    boxes inside one form? I have six different select boxes that are
    generated by six separate queries. The action page for all six
    select boxes is the same so I just want one submit button so users
    don't get confuse. I don't want to cluster up the page with submit
    buttons but I may resort to that option.
    My problem is the select boxes generate a number and when
    that number is submitted I want to pass two other variables with it
    to the action page. I tried putting a "Form" tag around the 6
    select boxes. Inside each select box I tried to add an "Input
    type="hidden"" and give thte name and values that I needed. That
    worked for the first select box but when I tried the second select
    box it used the hidden values for the first select box.
    If anyone can help, I would greatly appreciate it. Or if you
    have any other suggestions I am open to any.
    Thanks

    Paross1,
    I wasn't thinking about that and you gave me a great idea.
    Here is how I changed my select boxes.
    <cfform
    action="Resolution_History.cfm?year=#year#&sessiontype=#sessiontype#&btype=res"
    name="form">
    <select name="SRINPUT">
    <option value="">SR
    <CFOUTPUT Query="findSR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="HRINPUT">
    <option value="">HR
    <CFOUTPUT Query="findHR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="SCRINPUT">
    <option value="">SCR
    <CFOUTPUT Query="findSCR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <br>
    <select name="HCRINPUT">
    <option value="">HCR
    <CFOUTPUT Query="findHCR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="SJRINPUT">
    <option value="">SJR
    <CFOUTPUT Query="findSJR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <select name="HJRINPUT">
    <option value="">HJR
    <CFOUTPUT Query="findHJR"><Option
    Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
    </select>
    <INPUT TYPE="Submit" VALUE="Submit" alt="submit
    button">
    </cfform>
    On the action page I need the below IF statement to work so
    it will set the variables. It isn't working at this time. Its not
    bringing the values of billnumber, houseorig or the billtype.
    Do you have any thoughts? I know it is close. I need to set
    all of the inputs to input4 to generate my queries.
    <cfif form.srinput gt 0>
    <cfset houseorig eq "s">
    <cfset billtype eq "r">
    <cfset srinput eq input4>
    <cfelseif form.hrinput gt 0>
    <cfset houseorig eq "h">
    <cfset billtype eq "r">
    <cfset hrinput eq input4>
    <cfelseif form.scrinput gt 0>
    <cfset houseorig eq "sc">
    <cfset billtype eq "r">
    <cfset scrinput eq input4>
    <cfelseif form.hcrinput gt 0>
    <cfset houseorig eq "hc">
    <cfset billtype eq "r">
    <cfset hcrinput eq input4>
    <cfelseif form.sjrinput gt 0>
    <cfset houseorig eq "sj">
    <cfset billtype eq "r">
    <cfset sjrinput eq input4>
    <cfelse>
    <cfset houseorig eq "hj">
    <cfset billtype eq "r">
    <cfset hjrinput eq input4>
    </cfif>

  • Auto select with select box

    Hi
    I have a site which has 8 services.each service has it own
    page. When the user goes to the service page there will be a link
    which will take them to a form. I want the form to be able to
    identify which service is there and select that one automatically.
    I have done this previously but only with a form. Can you
    please help me to fix this.
    Link on service page
    <a href="moreinfo.cfm?service=WorkGroup Consultancy">Click
    here for Further Information</a>
    select box in form
    <select name="service">
    <option value="UK Immigration" <cfif
    structKeyExists(form,"UK Immigration") AND form.service eq
    "WorkGroup Consultancy">selected="selected"</cfif>>UK
    Immigration</option>
    <option <cfif structKeyExists(form,"WorkGroup
    Consultancy") AND form.service eq "WorkGroup
    Consultancy">selected="selected"</cfif>value="WorkGroup
    Consultancy">WorkGroup Consultancy</option>
    <option value="Legal Managment Software" <cfif
    structKeyExists(form,"Legal Managment Software") AND form.service
    eq "Legal Managment
    Software">selected="selected"</cfif>>Legal Managment
    Software</option>
    <option value="Search Engine Optimization" <cfif
    structKeyExists(form,"Search Engine Optimization") AND form.service
    eq "Search Engine
    Optimization">selected="selected"</cfif>>Search Engine
    Optimization</option>
    <option value="Marketing Consultancy" <cfif
    structKeyExists(form,"Marketing Consultancy") AND form.service eq
    "Marketing
    Consultancy">selected="selected"</cfif>>Marketing
    Consultancy</option>
    <option value="Project Management" <cfif
    structKeyExists(form,"Project Management") AND form.service eq
    "Project Management">selected="selected"</cfif>>Project
    Management</option>
    <option value="Training" <cfif
    structKeyExists(form,"Training") AND form.service eq
    "Training">selected="selected"</cfif>>Training</option>
    <option value="Web Design"<cfif
    structKeyExists(form,"Web Design") AND form.service eq "Web
    Design">selected="selected"</cfif>>Web
    Design</option>
    </select>

    I have tried both was and still cannot get it to work. Please
    shwo me the correct way to do this
    <cfselect name="service" selected="#url.service#">
    <option value="UK Immigration" >UK
    Immigration</option>
    <option value="WorkGroup Consultancy">WorkGroup
    Consultancy</option>
    <option value="Legal Managment Software" >Legal
    Managment Software</option>
    <option value="Search Engine Optimization" >Search
    Engine Optimization</option>
    <option value="Marketing Consultancy" >Marketing
    Consultancy</option>
    <option value="Project Management">Project
    Management</option>
    <option value="Training" >Training</option>
    <option value="Web Design">Web Design</option>
    </cfselect>
    And the other way
    option value="UK Immigration" <cfif structKeyExists(URL,"UK
    Immigration") AND url.service eq "WorkGroup
    Consultancy">selected="selected"</cfif>>UK
    Immigration</option>
    <option <cfif structKeyExists(url,"WorkGroup
    Consultancy") AND url.service eq "WorkGroup
    Consultancy">selected="selected"</cfif>value="WorkGroup
    Consultancy">WorkGroup Consultancy</option>
    <option value="Legal Managment Software" <cfif
    structKeyExists(url,"Legal Managment Software") AND url.service eq
    "Legal Managment
    Software">selected="selected"</cfif>>Legal Managment
    Software</option>
    <option value="Search Engine Optimization" <cfif
    structKeyExists(url,"Search Engine Optimization") AND url.service
    eq "Search Engine
    Optimization">selected="selected"</cfif>>Search Engine
    Optimization</option>
    <option value="Marketing Consultancy" <cfif
    structKeyExists(url,"Marketing Consultancy") AND url.service eq
    "Marketing
    Consultancy">selected="selected"</cfif>>Marketing
    Consultancy</option>
    <option value="Project Management" <cfif
    structKeyExists(url,"Project Management") AND url.service eq
    "Project Management">selected="selected"</cfif>>Project
    Management</option>
    <option value="Training" <cfif
    structKeyExists(url,"Training") AND url.service eq
    "Training">selected="selected"</cfif>>Training</option>
    <option value="Web Design"<cfif
    structKeyExists(url,"Web Design") AND url.service eq "Web
    Design">selected="selected"</cfif>>Web
    Design</option>

  • 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>

  • Autosuggest and select box

    I was wondering how to update a select box with data relevant
    to a selection made on a suggest box, something similar to
    this,
    but with a spry suggest box instead of the first select box on the
    example.
    I tried the example (two select boxes using two binded data
    sets) with my db and it works; when I select something on the first
    select box, the second one changes dynamically according to the
    selection made.
    I have defined two datasets:
    var ds1 = new
    Spry.Data.XMLDataSet("API/make_entry_list_xml.php","viperdb/entry",{sortOnLoad:"pdb_id",s ortOrderOnLoad:"ascending"});
    var ds2 = new
    Spry.Data.XMLDataSet("API/get_chains_for_entry_id.php?VDB={ds1::pdb_id}","viperdb/entry/c hain_id");
    and defined the suggest and select boxes as:
    <div id="suggest_1">
    <input type='text' id='vdb1'>
    <div id="resultsDIV_1" spry:region="ds1">
    <div spry:repeat="ds1" spry:suggest="{pdb_id}"
    onClick="ds1.setCurrentRowNumber(this.selectedIndex);"
    onchange="ds1.setCurrentRowNumber(this.selectedIndex);">
    <div class="suggest_list">{pdb_id}</div>
    </div>
    </div>
    <span spry:region="ds2" id="subdirSelector">
    <select spry:repeatchildren="ds2" name="subdirSelect">
    <option value="{chain_id}">{chain_id}</option>
    </select>
    </span>
    </div>
    Neither onclick nor onchange functions seem to work; on load
    the second select does fill up with ds2 data (acording to the first
    element of ds1), but when using the suggest box to select something
    different, the selectbox doesn't change accordingly, keeping always
    the same data.
    Am I using the setCurrentRowNumber in the wrong dataset or
    tag?

    I would say if you were to do somthing like this
    var ds1 = new
    Spry.Data.XMLDataSet("API/make_entry_list_xml.php","viperdb/entry",{sortOnLoad:"pdb_id",s ortOrderOnLoad:"ascending",useCache:false});
    see I added the useCache:false
    This will stop the browser from cacheing your xml, thenjust
    add an onclick to some function like say
    update();
    then have update do this
    function update()
    ds1.loadData();
    That should cause the browser to update the data set and
    update your elements now the only downside is IE has a bug well
    more like IE being the bug but anyhow you may have to add things to
    your code to get it to work right in IE, I added in some random
    number script in my JS so that it will append on the end of my DS
    each time so IE thinks its a new XML doc. Hope this helps.

  • Can I parse Text files in Java Script to populate in select boxes.

    The scenario is as follows:
    I have two select boxes, the second one depends on the first one for its values.
    Values corresponding to the selection made in the first select box are available in a text file.
    Can I parse the text file to fill in the values in the second select box through javascript?
    Can any one please help.
    Thanks,
    Ramesh

    This isn't a javascript forum. Java is not Javascript and Javascript is not Java.
    If you actually meant Java...the answer is "maybe, depending on what you're doing".

  • Populate the JSP's select box from database on jsp load

    hai all,
    can any one help me in knowing how to populate the select box of a jsp
    with data from the database?
    thanks and regards,
    ravikiran

    <%
    String sQuery = "select id,Name from tablename";
    rs = stmt.executeQuery(sQuery);
    %>
    <select name="sltName">
    <%
    while(rs.next()){
    String sId = rs.getString(1);
    String sName = rs.getString(2);
    %>
    <option value="<%=sId %>" > <%=sName %> </option>
    <%
    %>
    </select>

Maybe you are looking for