View Full Version : Select field allowing input!!!!

09-05-2008, 02:27 PM
Hi! I am wondering if this can be done!! Can you help me.I want user to input value in a select field and upon starting inputing the value the input value which user is entering should be compared with the options of the select field and the value which match is displayed for user to select it,I want to reduce scrolling because the select field has a lot of options,its more or less the same like in browsers at the url input field when you start entering the url there are options in a drop down list

09-05-2008, 04:47 PM
Like this?:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function selectOption(inp){
var r=new RegExp('^'+inp.value,'i');
var opt=inp.form['sel'].options, i=0, o;
select the country or input the first letter(s)
<input type="text" onkeyup="selectOption(this)">
<select name="sel">
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="Andorra">Andorra</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</option>

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum