select option with text facility

select option with text facility

View Answers

March 23, 2009 at 12:05 AM

Hi friend,

Code to help in solving the problem :

<HTML>
<HEAD>
<TITLE>Editable Dropdown / Listbox / Combobox - HTML, JavaScript</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function keyDown(getdropdown, e)
{
checkFn(getdropdown);
var vEventKeyCode = keyCode(e);
// Press left/right arrow keys
if(vEventKeyCode == 37)
{
fnLeftToRight(getdropdown);
}
if(vEventKeyCode == 39)
{
fnRightToLeft(getdropdown);
}

// Delete key pressed
if(vEventKeyCode == 46)
{
fnDelete(getdropdown);
}

// backspace key pressed
if(vEventKeyCode == 8 || vEventKeyCode==127)
{
if(e.which) //Netscape
{
//e.which = ''; //this property has only a getter.
}
else //Internet Explorer
{
//To prevent backspace from activating the -Back- button of the browser
e.keyCode = '';
if(window.event.keyCode)
{
window.event.keyCode = '';
}
}
return true;
}

// Tab key pressed, use code below to reorient to Left-To-Right flow, if needed
//if(vEventKeyCode == 9)
//{
// fnLeftToRight(getdropdown);
//}
}

function fnLeftToRight(getdropdown)
{
getdropdown.style.direction = "ltr";
}

function fnRightToLeft(getdropdown)
{
getdropdown.style.direction = "rtl";
}

function fnDelete(getdropdown)
{
if(getdropdown.options.length != 0)
// if dropdown is not empty
{
if (getdropdown.options.selectedIndex == vEditableOptionIndex_A)
// if option the Editable field
{
getdropdown.options[getdropdown.options.selectedIndex].text = '';
getdropdown.options[getdropdown.options.selectedIndex].value = '';
}
}
}

March 23, 2009 at 12:06 AM

function keyCode(e)
{
if(e.which)
{
keycode=e.which; //Netscape
}
else
{
keycode=e.keyCode; //Internet Explorer
}

//alert("keyCode"+ keycode);
return keycode;
}

function charKeyFn(e)
{
keycode = keyCode(e);
if((keycode==8)||(keycode==127))
{
character="backspace"
}
else if((keycode==46))
{
character="delete"
}
else
{
character=String.fromCharCode(keycode);
}
//alert("FindKey"+ character);
return character;
}

function checkFn(getdropdown)
{
if(vEditableOptionIndex_A>(getdropdown.options.length-1))
{
alert("PROGRAMMING ERROR: The value of variable vEditableOptionIndex_... cannot be greater than (length of dropdown - 1)");
return false;
}
}
</SCRIPT>

March 23, 2009 at 12:07 AM


<SCRIPT LANGUAGE="JavaScript">



var vEditableOptionIndex_A = 0;



var vEditableOptionText_A = "--?--";



var vPreviousSelectIndex_A = 0;


var vSelectIndex_A = 0;


var vSelectChange_A = 'MANUAL_CLICK';


function changeFn(getdropdown)
{
checkFn(getdropdown);

vPreviousSelectIndex_A = vSelectIndex_A;

vSelectIndex_A = getdropdown.options.selectedIndex;


if ((vPreviousSelectIndex_A == (vEditableOptionIndex_A)) && (vSelectIndex_A != (vEditableOptionIndex_A))&&(vSelectChange_A != 'MANUAL_CLICK'))

{
getdropdown[(vEditableOptionIndex_A)].selected=true;
vPreviousSelectIndex_A = vSelectIndex_A;
vSelectIndex_A = getdropdown.options.selectedIndex;
vSelectChange_A = 'MANUAL_CLICK';

}
}

function pressFn(getdropdown, e)
{
checkFn(getdropdown);

keycode = keyCode(e);
keychar = charKeyFn(e);


if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32))
{
var vAllowableCharacter = "yes";
}
else
{
var vAllowableCharacter = "no";
}


if(getdropdown.options.length != 0)

if (getdropdown.options.selectedIndex == (vEditableOptionIndex_A))

{

var vEditString = getdropdown[vEditableOptionIndex_A].value;


if((vAllowableCharacter == "yes")||(keychar=="backspace"))
{
if (vEditString == vEditableOptionText_A)
vEditString = "";
}
if (keychar=="backspace")
{
vEditString = vEditString.substring(0,vEditString.length-1);


vSelectChange_A = 'MANUAL_CLICK';

}


if (vAllowableCharacter == "yes")

{
vEditString+=String.fromCharCode(keycode);


var i=0;
var vEnteredChar = String.fromCharCode(keycode);
var vUpperCaseEnteredChar = vEnteredChar;
var vLowerCaseEnteredChar = vEnteredChar;


if(((keycode)>=97)&&((keycode)<=122))

vUpperCaseEnteredChar = String.fromCharCode(keycode - 32);



if(((keycode)>=65)&&((keycode)<=90))

vLowerCaseEnteredChar = String.fromCharCode(keycode + 32);

if(e.which)
{

for (i=0;i<=(getdropdown.options.length-1);i++)
{
if(i!=vEditableOptionIndex_A)
{
var vReadOnlyString = getdropdown[i].value;
var vFirstChar = vReadOnlyString.substring(0,1);
if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar))
{
vSelectChange_A = 'AUTO_SYSTEM';

break;
}
else
{
vSelectChange_A = 'MANUAL_CLICK';

}
}
}
}
}

// Set the new edited string into the Editable option
getdropdown.options[vEditableOptionIndex_A].text = vEditString;
getdropdown.options[vEditableOptionIndex_A].value = vEditString;

return false;
}
return true;
}

March 23, 2009 at 12:07 AM

function keyUpFn(getdropdown, e)
{
checkFn(getdropdown);

if(e.which) // Netscape
{
if(vSelectChange_A == 'AUTO_SYSTEM')
{

getdropdown[(vEditableOptionIndex_A)].selected=true;
}

var vEventKeyCode = keyCode(e);
// if [ <- ] or [ -> ] arrow keys are pressed, select the editable option
if((vEventKeyCode == 37)||(vEventKeyCode == 39))
{
getdropdown[vEditableOptionIndex_A].selected=true;
}
}
}



</SCRIPT>

March 23, 2009 at 12:08 AM

</HEAD>
<BODY>
<FORM name="selectFrm" method="post">
<center>
<br>
<SELECT name="user" id="user" style="" onKeyDown="keyDown(this, event);" onKeyUp="keyUpFn(this, event); return false;" onKeyPress = "return pressFn(this, event);" onChange="changeFn(this, event);">
<OPTION value=""></OPTION>
<option>option1</option>
<option>option2</option>
<option>option3</option>
<option>option4</option>
<option>option5</option>
</SELECT>
<br>
</center>
</FORM>
</BODY>
</HTML>

Thanks









Related Tutorials/Questions & Answers:
select option with text facility - JSP-Servlet
select option with text facility  Hello. My doubt is regarding how to provide facility to add text in a drop down box ie(select tag in html )in a jsp... the select in html and if the user wants also to directly type the option instead
validate select option jquery
validate select option jquery  How to Validate select option in JQuery
Advertisements
select option - JDBC
select option  how to dynamically generate the select option values from database
select option value
select option value  if i select a value of any drop down...("Select * from country"); while(rs.next()){ %> <option value... id='state'> <select name='state' > <option value='-1
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... buffer="<select name='state' ><option value='-1'>Select</option>
jsp drop down-- select Option
a country:</b>&nbsp;</td> <select name="sel"><option value... = stmt.executeQuery("Select * from country"); while(rs.next()){ %> <option value...; <select name='state' > <option value='-1'></option> <
select box and text box validations
select box and text box validations  hi, any one please tell me how to set validations for select box and text boxes using bean classes? thank you   Please visit the following link: http://www.roseindia.net/jsp/user
jQuery change event with multiple select option
;; $("select option:selected").each(function () { str += $(this).text...jQuery change event with multiple select option In this tutorial , we...; it also display the selected option. In the below example a multiple select list
How to add another option to the select tag using struts2 tag - Struts
How to add another option to the select tag using struts2 tag  Hi, How to add another option to select tag using tag. My scenario is : If the logged in user is admin then drop down should contain the normal list
Add values of drop down menu( select option) to mysql table
Add values of drop down menu( select option) to mysql table   Here...['valveId'].'<td>'; echo '<select name="onoff">'; echo '<option value="ON">ON'; echo '</option>'; echo '<option
Javascript get Date And Selected Option Text
Javascript get Date And Selected Option Text In this tutorial we will learn... to get the selected option text and displayed in Javascript. This tutorial explains you that how to display the date and the selected option text in Javascript
how to create text file from jsp and provide downlode option
option of this text field thanks in advanceADS_TO_REPLACE_3   Hi Friend...how to create text file from jsp and provide downlode option  HI... in java/j2ee tech. my question is who do i make a jsp output in the form of text
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
sir plz help in design a jsp page whichis as follow username [_____] select [__>]password [_____] after selection then onlypassword text box is visible
sir plz help in design a jsp page   sir plz help in design a jsp page which is as follow username [ _ ] select [ > ] password [ _ ] after selection then only password text box is visible
ModuleNotFoundError: No module named 'edc-facility'
ModuleNotFoundError: No module named 'edc-facility'  Hi, My Python... 'edc-facility' How to remove the ModuleNotFoundError: No module named 'edc-facility' error? Thanks   Hi, In your python
iPhone Text Field Border 
to the view, after adding will select each text field and then go to tools ->...Text Field Boarder  In this tutorial will learn about the text field Boarder, we can set the boarder of text field by selecting the text field
PHP Form Part-6 - How to Deals with Text Boxs
Topic : HTML FORM - How to Deal with Text Boxs in PHP Part - 6 In the previous part of HTML FORM tutorial, we learned how to deal with text box.ADS... buttons. A radio button does not give the choice to the users to select multiple
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 be displayed automatically in empty text fields. I am using struts 1.2
Column select
Column select   How i fetch Experience wise resume?   ... or no. Then using the query select * from resumes where experience='yes', fetch all the data...("jdbc:mysql://localhost:3306/test", "root", "root"); String query = "select * from
Use of Text Field
: A dropdown box is type of list from where an user can select one option out... Use of Text Field, Text box, Text Area, Checkbox,Dropdownlist and Radio...; By using form in HTML, users are allowed to enter or select different
ModuleNotFoundError: No module named 'odoo9-addon-openeducat-facility'
ModuleNotFoundError: No module named 'odoo9-addon-openeducat-facility' ...: ModuleNotFoundError: No module named 'odoo9-addon-openeducat-facility' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-openeducat-facility' error
textfield selected text
textfield selected text  How to select text in text field
gradient text, text effect, text
: Select Horizontal Type Tool (T key) and write text as you want. ADS_TO_REPLACE_2... How to make a gradient text       We can make many different type of text by the help
ModuleNotFoundError: No module named 'option'
ModuleNotFoundError: No module named 'option'  Hi, My Python... 'option' How to remove the ModuleNotFoundError: No module named 'option'... to install padas library. You can install option python with following command
how to use JOptionPane.YES_NO_OPTION
how to use JOptionPane.YES_NO_OPTION  As i said earliar i am making HRMS , the last phase is logout button. when logout button is clicked , an option dialog should appear which ask for yes or no . PROBLEM is i dont know how
Multiple select box
Multiple select box  Hi, I need help in code for multiple select box. The multiple select box should be populated with the db values.The selection done in the multiple select box is to be moved to the text area provided a add
SET and SELECT
SET and SELECT  hello, What is difference between SET & SELECT in sql????   hii,ADS_TO_REPLACE_1 SET : The set statement is used to the update query. SELECT : The select statement is used to display the all
dynamic select box
dynamic select box  thank u my dear friend.but i have a code like...;/label></td> <td><input type="text" name="lastname" value...;First Name</label></td> <td><input type="text" name
cn.herodotus.engine - facility-core version 3.1.1.2 Maven dependency. How to use facility-core version 3.1.1.2 in pom.xml?
cn.herodotus.engine  - Version 3.1.1.2 of facility-core Maven dependency? How to use  cn.herodotus.engine  - Version 3.1.1.2 of facility-core in pom.xml? How to use facility-core version 3.1.1.2 in pom.xml? Learn to use
select query
select query  how to write select query with where clause having multiple variables. example: i want to select the data from DB in which i want to check againest two variable in where cluase. String sql = "select * from
select query
select query  how to retrieve a single image from mysql table using $row[] value
The option tag
In this section, you will learn about the option tag of Spring form tag library
Select DropDown Default
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.... the problem is if the user select "View ALL Pages" it will dislay nothing. what
Option Box Value - Java Beginners
Option Box Value  Hi Friends, I have one option box which is division, division have dynamically data,if user select any division then his option box is populated (work schedule,Peronal Area,personal sub area,business
Option onclick am not getting the value ..
Option onclick am not getting the value ..    function get_val( tot_val ) { document.getElementById('TextBox1').value = tot_val; } <..." rows="5" cols="20">   Here is a simple code that insert some text
Dynamic select box - Ajax
Dynamic select box  Hi, I Have almost completed the task... select boxes in my page.. One is "Select a Country" and other one is "Select... in the other select box automatically.. The city details must be extracted from
Dojo Filtering Select
Dojo Filtering Select        ... select.  FilteringSelect: The FilteringSelect is same as html select tag... in the combo box. It allows only the selection facility. But filteringselect allows
nested select tag
("count"); String buffer="<select name='state'><option value='-1'>...nested select tag  My requirement is as follows suppose combobox to select country whenever i select a country it will show corresponding states
jQuery 'select' form event
input box. In this Example, two input text box are given , when we select...; Click and drag the mouse to select text in the input box. </p>..._TO_REPLACE_1 OUTPUT When we select some text inside inputs : ADS
Maven dependency for cn.herodotus.engine - facility-core version 2.7.1.0 is released. Learn to use facility-core version 2.7.1.0 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.1.0. Developer can use this version ( cn.herodotus.engine - facility-core
Maven dependency for cn.herodotus.engine - facility-core version 2.7.0.50 is released. Learn to use facility-core version 2.7.0.50 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility-core project have released the latest version of this library on 18 Jun 2022, the released version of  cn.herodotus.engine - facility-core library
Maven dependency for cn.herodotus.engine - facility-core version 2.7.0.30 is released. Learn to use facility-core version 2.7.0.30 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility-core project have released the latest version of this library on 01 Jun 2022, the released version of  cn.herodotus.engine - facility-core library
Maven dependency for cn.herodotus.engine - facility-core version 2.7.0.10 is released. Learn to use facility-core version 2.7.0.10 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility-core project have released the latest version of this library on 25 May 2022, the released version of  cn.herodotus.engine - facility-core library
Maven dependency for cn.herodotus.engine - facility-core version 2.7.3.0 is released. Learn to use facility-core version 2.7.3.0 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.3.0. Developer can use this version ( cn.herodotus.engine - facility-core
Maven dependency for cn.herodotus.engine - facility-core version 2.7.2.5 is released. Learn to use facility-core version 2.7.2.5 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.2.5. Developer can use this version ( cn.herodotus.engine - facility-core
Maven dependency for cn.herodotus.engine - facility-core version 2.7.2.4 is released. Learn to use facility-core version 2.7.2.4 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.2.4. Developer can use this version ( cn.herodotus.engine - facility-core
Maven dependency for cn.herodotus.engine - facility-core version 2.7.2.2 is released. Learn to use facility-core version 2.7.2.2 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.2.2. Developer can use this version ( cn.herodotus.engine - facility-core
Maven dependency for cn.herodotus.engine - facility-core version 2.7.2.0 is released. Learn to use facility-core version 2.7.2.0 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.2.0. Developer can use this version ( cn.herodotus.engine - facility-core
Maven dependency for cn.herodotus.engine - facility-core version 2.7.1.2 is released. Learn to use facility-core version 2.7.1.2 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.1.2. Developer can use this version ( cn.herodotus.engine - facility-core
Maven dependency for cn.herodotus.engine - facility-core version 2.7.6.0 is released. Learn to use facility-core version 2.7.6.0 in Maven based Java projects
of facility-core released The developers of   cn.herodotus.engine - facility..., the released version of  cn.herodotus.engine - facility-core library is 2.7.6.0. Developer can use this version ( cn.herodotus.engine - facility-core

Ads