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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic drop down and corresponding text fields

Status
Not open for further replies.

IVisualise

Technical User
Feb 6, 2003
10
CA
Hi,

I have a dynamic drop down list that gets its values from the database. I would like to have a text field containing an email address pertaining to the name selected in the drop down list. This email is part of the same record that the names are coming from.

Any help would be appreciated.

Thanks
 
Use value property to store e-mails and put selected value into text field when selected name is changed.

Example:

<form name=&quot;frm&quot;>
Select Person:
<select name=&quot;person&quot; onchange=&quot;document.forms.frm.email.value=this.options[this.selectedIndex].value&quot;>
<option value=&quot;&quot;>Select Person</option>
<option value=&quot;peter@fox.com&quot;>Peter Foxter</option>
<option value=&quot;tom@earthlink.net&quot;>Tom McWilson</option>
<option value=&quot;john@ibm.com&quot;>John Caster</option>
</select><br>
Person e-mail:
<input name=&quot;email&quot; size=&quot;40&quot; value=&quot;&quot;>
</form>

Regards,
Sergey Smirnov
 
Thanks Sergey,

But I want to populate the list text field with emails from the database.

for example, if I select Peter from the first drop down list (which is being populated from the DB), then the text field should fill in the email address mentioned in the record Peter was chosen from.

Thanks
 
How many persons (e-mails) you have in your DB. If you have less than 100 records, it is possible to take them at once and put onto the page. In this way, you can use code shown above.

Otherwise, if you have huge number of records or you have another reason do not show emails on page, you solution will not be so easy.
 
I have about 30 emails. So how do I take them at once? The recordset I'm pulling the names in does include the emails.
Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top