florida
08-16-2005, 06:29 PM
I am trying to get a drop down select where I make a selection of a last name it will populate the last name text box and a first name text box:
If I have a selection of names such as this:
Smith, Mark
Jones, Rich
Carson, Mike
then when I select Jones, Rich it will populate my text boxes with Jones going into the Last Name text box and Mark going into the First name text box.
Here is my attempt but not working:
function populateTxt2(txt)
{
if (txt.length > 0)
{
document.request.LastName.value = txt;
document.request.FirstName.value = txt;
}
}
<SELECT NAME="mySelect2" multiple="2" onchange="populateTxt2(this.options[this.selectedIndex].value);">
<OPTION VALUE=""></OPTION>
<OPTION VALUE="Smith,Rich">Smith,Rich</OPTION>
<OPTION VALUE="Smith,Mark">Smith,Mark</OPTION>
<OPTION VALUE="Jones,Rich">Jones,Rich</OPTION>
<OPTION VALUE="Carson,Mike">Carson,Mike</OPTION>
</SELECT><br>
First Name <input type="text" name="FirstName">
Last Name <input type="text" name="LastName">
If I have a selection of names such as this:
Smith, Mark
Jones, Rich
Carson, Mike
then when I select Jones, Rich it will populate my text boxes with Jones going into the Last Name text box and Mark going into the First name text box.
Here is my attempt but not working:
function populateTxt2(txt)
{
if (txt.length > 0)
{
document.request.LastName.value = txt;
document.request.FirstName.value = txt;
}
}
<SELECT NAME="mySelect2" multiple="2" onchange="populateTxt2(this.options[this.selectedIndex].value);">
<OPTION VALUE=""></OPTION>
<OPTION VALUE="Smith,Rich">Smith,Rich</OPTION>
<OPTION VALUE="Smith,Mark">Smith,Mark</OPTION>
<OPTION VALUE="Jones,Rich">Jones,Rich</OPTION>
<OPTION VALUE="Carson,Mike">Carson,Mike</OPTION>
</SELECT><br>
First Name <input type="text" name="FirstName">
Last Name <input type="text" name="LastName">