Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADD an entry in Combo Box.

Status
Not open for further replies.

paragvshah

Programmer
Joined
Jan 11, 2001
Messages
109
Location
IN
Hi friends,

I want a combo box in which i can add an entry as well as there will be values coming in from database. How this type of combo box is possible.

Please help me out.

Parag.
 
Hey Parag,

this is how I add an item to a combo box dynamically, you can trigger this with a button or with an OnBlur or OnChange or whatever but basically this is what you need:

<SCRIPT Language=&quot;JavaScript&quot;>
<!--
function updateselectbox(form)
{
(form.SelectBoxName.length)++;
form.SelectBoxName.options[form.SelectBoxName.length - 1].text = &quot;New Item Text&quot;;
form.SelectBoxName.options[form.SelectBoxName.length - 1].value = &quot;New Item Value&quot;;

}
//-->
</script>

Then trigger that function from your form and you're set. Let me know if you have any trouble implementing it.

have fun...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top