Hi Nasir!!
Do you want to add these textbox values to dropdown from the client side??
e.g there is a text box ,dropdown and button.
user enters some name and clicks on the button,now only on the client side do you want to appear to the dropdown??(without post back to the server).
Then again its depends on technology(asp,php,or .NET) and the requirements/implementations too!!
Following code will give some directions on it
<script>
function addToDropdown()
{
//put your validation here before attaching to dropdown
txtName=document.getElementById('txtbox').value;
txtValue=txtName //if you want diff value put ur validation here
obj=document.getElementById("ddbox");
obj.options[obj.options.length] = new Option(txtName,txtValue)
obj.selectedIndex=obj.options.length-1;
}
</script>
<select name="ddbox" id="ddbox"></select>
<input type=text id="txtbox" >
<input type=button onclick="addToDropdown()" value="add To Dropdown">
to remove selected dropdown value/text
obj.options[obj.selectedIndex] = null;
Cheers :)
vinod
|