Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet help to select a value from the dropdown list

Have Programming Question? Ask it here!
 
 
 


kim
help to select a value from the dropdown list
0 Answer(s)      2 years and 8 months ago
Posted in : JSP-Servlet


I have a html file called autoSuggestTextbox.html which is shown below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1
-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Auto Complete</title>
    <script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
    <script type="text/javascript">

    function lookup(inputString) {
        if(inputString.length == 0) {
        $('#suggestions').hide();
        } else {
        $.post("SearchIndex.jsp", {queryString: ""+inputString+""}, function(data){
        if(data.length >0) {
        $('#suggestions').show();
        $('#autoSuggestionsList').html(data);

            }
        });
    }
    }


    function fill(thisValue) {
    //alert ($('#autoSuggestionsList').show());
        $('#inputString').val(thisValue);
        setTimeout("$('#suggestions').hide();", 200);
    }

    $('#inputString').select(function() {
  alert('Handler for .select() called.');
});

function selectText(suggestions)
{
if (document.selection)
{
var div = document.body.createTextRange();

div.moveToElementText(document.getElementById(suggestions));
div.select();
}
else
{
var div = document.createRange();

div.setStartBefore(document.getElementById(suggestions));
div.setEndAfter(document.getElementById(suggestions)) ;

window.getSelection().addRange(div);
}

}

    </script>
    <style type="text/css">
    body {
    font-family: Helvetica;
    font-size: 13px;
    color: #000;
    }
    h3 {
    margin: 0px;
    padding: 0px;
    }
    .suggestionsBox {
    position: relative;
    left: 260px;
    margin: 0px 0px 0px 0px;
    width: 200px;
    background-color: #7845DD;
    -moz-border-radius: 7px;
    -webkit-border-radius: 7px;
    border: 2px solid #000;
    color: #fff;
    }
    .suggestionList {
    margin: 0px;
    padding: 0px;
    }
    .suggestionList li {
    margin: 0px 0px 3px 0px;
    padding: 3px;
    cursor: pointer;
    }
    .suggestionList li:hover {
    background-color: #DD45CD;
    }
    </style>
</head>
<body>
<div>
<form>
<div> <h3><font color="red"><a href="file:////home/SPLTeam7/GlassFish_Server/glassfish/domains/domain1/docroot/hms/autoSuggestTextbox.html">Indian States
  </states>
</a></font></h3>
<br /> Enter India State Name to see autocomplete
<input type="text" size="30" name="inputString" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" onclick="selectext(autoSuggestionsList);"/>
<button onclick="selectText(suggestions)">Select Text</button>
</div>
<div class="suggestionsBox" id="suggestions" style="display: none;">
<div class="suggestionList" id="autoSuggestionsList">
</div>
</div>
</form>
</div>
</body>
</html>


I also have a jsp file called SearchIndex.jsp which is shown below

<jsp:useBean id="sessionBean" scope="session" class="com.spl.hms.SessionBean"></jsp:useBean>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.text.*"%>
<% response.setContentType("text/html");%>

<script langauage="Javascript">

var inputString;
function Go()
{
       location.href = 'autoSuggestTextbox.html?inputString=' + document.getSelection("inputString").value;

}
</script>

<%

String stri=request.getParameter("queryString");

String SQLstr = "SELECT service_type FROM pb_operating_parameters WHERE  service_type ILIKE '"+stri+"%' LIMIT 10";
     ResultSet wardsRs = sessionBean.getDataResultSet(SQLstr);

                   Boolean colorRow = false;
                   try{
                      while(wardsRs.next()){
                        out.println("<li 'fill("+wardsRs.getString("service_type")+");'>"
+wardsRs.getString("service_type")+"</i>"); 
    }
     }catch(NullPointerException sqle){
                       out.print(sqle.getMessage());
                   }catch(Exception sqle){
                       out.print(sqle.getMessage());
                   }
    %>

Please can someone help me on how to select a value from the drop down list created in a div and put it in the textbox

kim


Advertisement
View Answers

Related Tutorials/Questions & Answers:
help to select a value from the dropdown list
help to select a value from the dropdown list  I have a html file...()); } %> Please can someone help me on how to select a value... = "SELECT service_type FROM pb_operating_parameters WHERE service_type ILIKE '"+stri
how to load value in dropdown list after selecting value from first dropdown list using javascript
how to load value in dropdown list after selecting value from first dropdown list using javascript  how to load value in dropdown list after selecting value from first dropdown list using javascript
Advertisements
Retriving value from dropdown list nad disply it in other page
Retriving value from dropdown list nad disply it in other page  Hello... of the selected value from the dropdown list and dispaly it to on the next page. i... you please help me out with this!! thanks, Pradeep
getting values from dropdown list
getting values from dropdown list  I am having a dropdown list which... the database) My question is when i select a particular value it should be pass... the selected value to the action. Please can any one please help me out
how to set value of dropdown list
how to set value of dropdown list  Hello Sir, I'd solved the earlier problems somehow but now this time another problem arised when I want to pass the value from a link to a dropdown list. I want to set the dropdown list selected
how to set value of dropdown list
how to set value of dropdown list  Hello Sir, I'd solved the earlier problems somehow but now this time another problem arised when I want to pass the value from a link to a dropdown list. I want to set the dropdown list selected
Select from select list + display
Select from select list + display  i have a select list containing... select EmpCode from the select list, the corresponding EmpName and DeptName should...=con.createStatement(); ResultSet rs=st.executeQuery("select * from emp
3 dropdown list from the database using JSP
3 dropdown list from the database using JSP  Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
how to use dropdown list in JSP and display value in same page
how to use dropdown list in JSP and display value in same page  I have a Dropdown list with some values say "A", "B" and "C" When the user selects one option the value must get displayed below it in the same page
DropDown list
values into dropdown list. 1)country.jsp: <%@page import="java.sql.*"%>... = con.createStatement(); ResultSet rs = stmt.executeQuery("Select * from country...;select name='state' > <option value='-1'></option> <
How to automatically change the value of the textbox based on the dropdown list?
How to automatically change the value of the textbox based on the dropdown list...=con.prepareStatement("Select item_name from items order by item_name"); ResultSet rst2=stmt.executeQuery("Select * from items where item
JSP Get Data Into Dropdown list From Database
JSP Get Data Into Dropdown list From Database In this section we will discuss about how to fetch data dynamically into the dropdown list in JSP... data from the database and set it into the dropdown list in JSP using MySQL
How to access Contacts from gmail using LDAP in JSP dropdown list
How to access Contacts from gmail using LDAP in JSP dropdown list  HI, I am creating a JSP page in which i have to make a dropdown box, and access gmail contacts in that drop downlist using LDAP. Can any one plz help me out
dropdown list in jsf
dropdown list in jsf  I want to add a list box to display the country name from the lists on all countries.When I select for e.g India then in the second list box it will display the states related to India only and the flow
Retrieval of Dropdown list
, the corresponding value of A1, list of name corresponding to A1 wil be displayed in another... = con.createStatement(); ResultSet rs = stmt.executeQuery("Select * from groupdetail...("Select * from memberdetail where groupname='" + groupname
Select DropDown Default
i want to do is if the user select the "View ALL Page" from the dropdown menu...Select DropDown Default  Hi there, i have a program in JSP where i..., i.e if the user select PAGE 1 in the dropdown menu, it will display all
dropdown list in jsp
dropdown list in jsp  hai, i have static dropdown list.. i want to get the selected value in string variable without jsp regards asha
how to add data dynamically from database into a dropdown list in a jsp
how to add data dynamically from database into a dropdown list in a jsp ... list.In that first list is for department and the 2nd list for the names of the persons who work in that department.The values into the drop down list should
. Display JavaScript dropdown selected value
;/html> Description: Create dropdown list by using select and option tag. Now when you select any value from list, alert will display that. In var... value from dropdown box? I am using javascript.   <html> <
struts dropdown list
struts dropdown list   In strtus how to set the dropdown list values from database ? I have a ArrayList object and set this object in dropdown jsp... = MasterDataDAO.getValues(list); request.setAttribute("masterlist", masterList
jsp- database dependent dropdown list
jsp- database dependent dropdown list   i want 2 dropdown list 1- CLASS 2-SECTION both are should come from database. and if i select a class suppose class a the corresponding section dropdown list should retrieve the section
how can i send a mail to a particular user from a many user dropdown list in jsp
how can i send a mail to a particular user from a many user dropdown list in jsp  how can i a sent a user question to a particular person from a drop down list in jsp
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list...=mysql_query("select * from age order by Age_Desc"); while($row_list=mysql_fetch
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list...=mysql_query("select * from age order by Age_Desc"); while($row_list=mysql_fetch
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list...=mysql_query("select * from age order by Age_Desc"); while($row_list=mysql_fetch
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Hii Sir, Lots of thnx to ur reply .I went through both... of selecting value from autocomplete textbox using jquery in jsp from mysql database
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database. ... but was unable to find out exact way to fullfill the solution of selecting value from autocomplete textbox using jquery in jsp from mysql database. Kindly send me
dropdown list and text fields in php
dropdown list and text fields in php  How could I use php to populate text fields by selecting a name of a business from dropdown list? Those text... number, description, and opening times from a mysql database. If you can, post
getting and storing dropdown list in database in jsp
getting and storing dropdown list in database in jsp  i have a drop down list to select book from database. i'm able to retrieve dropdown list from database. but unable to store the selected value in database table. please help
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am... to a dropdownlist or an unordered list and also i have to send this data to struts action class? And i have no idea how to implement this. Any help is appreciated
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am... to a dropdownlist or an unordered list and also i have to send this data to struts action class? And i have no idea how to implement this. I am using jsp. Any help
add text box and select list dynamically and get its value to store it into database using jsp request parameter
add text box and select list dynamically and get its value to store... dynamically added text field but want code to retrive value of dynamically added select box also into next jsp page plz reply me as early as posssible
Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP  as i said i want to create 3 drop dropdown list each depend on the other and get the options from
creating list in dropdown using struts - Struts
creating list in dropdown using struts   creating list in dropdown using struts : In action class list.add(new LabelValueBean("ID","Name")); In Jsp * Select Item Select In Form : getter
Dropdown Checkbox list
Dropdown Checkbox list This tutorial explains how to create jquery Dropdown... jquery Dropdown Checkbox list. The application directory structure should look like... dropdown , then displays dropdown list as checkbox  You can
select option value
select option value  if i select a value of any drop down then that value should be used in a select query of the next dropdown in jsp????  ...("Select * from country"); while(rs.next()){ %> <option value
select option value
select option value  if i select a value of any drop down then that value should be used in a select query of the next dropdown in jsp on same page... the value from first combobox, the dependent values will get stored into second
How to add a DropDown List in Flex DataGrid
select from one of the choices in the list. That's my reason for trying to add...How to add a DropDown List in Flex DataGrid  hi I am trying to add... the value back to the data provider?? Problem : so when I try to select blue
Multiple select dropdown with Ajax
Multiple select dropdown with Ajax This tutorial explains how to create... ArrayList(); String sqlqueary="SELECT * FROM category where parent_id=0...(); String sqlqueary="SELECT * FROM category where parent_id="+allcategoryid[i
How to add a DropDown List in Flex DataGrid
select from one of the choices in the list. That's my reason for trying to add...How to add a DropDown List in Flex DataGrid  hi I am trying to add... the value back to the data provider?? Problem : so when I try to select blue
dropdown
dropdown  how to hide textbox field when i deselect from select dropdown
i want to select a multiple value of check box by using onclick or onchange event without using from submission
i want to select a multiple value of check box by using onclick or onchange event without using from submission   i have 4 check box name 1)profile...)1000-1500 3)1500-2000 4)2000-2500 when i am selecting first value of checkbox
How to display content in same page while selecting fron dropdown list
dropdownlist in jsp page.If i select any value in that list(for eg-rollno),then it want to display all records from table specific to that rollno in that same...How to display content in same page while selecting fron dropdown list 
Help with SELECT/JOIN statement
Help with SELECT/JOIN statement  I have two tables (t1 and t2... a select statement that will return me all rows of t1 but, when t1.id = t2.id, I... | value ------------------- 1 | joe | 3 2 | bob | 5 3 | ted | 7 t2
How to add dropdown list in a row of a sort table applet?
How to add dropdown list in a row of a sort table applet?  How to add dropdown list in a row of a sort table applet
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
to access value of drop down value in beans when dropdown is populated using ajax
to access value of drop down value in beans when dropdown is populated using ajax  i want to access value of dropdown box in beans .. and this drop down was filled using ajax. plz help
For every option selected from a dropdown a new textbox opens
For every option selected from a dropdown a new textbox opens  I have a dropdown with four options, each time I select an option a new text box... the dropdown list and allow the user to use onchange event. As the user clicks
Dropdown code to retrieve result from oracle database
Dropdown code to retrieve result from oracle database  Hi Friends, I... need to fetch the result when the dropdown is chosen.Can anyone please help me... that will retrieve values from the database into dropdown. As the user choose any option
dropdown
dropdown  I have a dropdown having 2 options-"Open"& "closed".When i select "open" option the related rows of data are retrieved from database and same with the other option.My database is Mysql and coding in PHP
Advertisements
 

 

 

DMCA.com