I can populating a text field from drop down. Help make it populating two text fields

0 replies
  • WEB DESIGN
  • |
Here are a simple script, for populating a text field from drop down,
for example how it works : user clicking on option 1, then the textfield showValue1 will filled/fired with 1a



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="theform" onsubmit="CheckForm()">
<select name="myOptions" onchange="document.theform.showValue1.value=this.v alue">
<option value="">Please select an option</option>
<option value="1a">1</option>
<option value="2a">2</option>
<option value="3a">3</option>
<option value="4a">4</option>
</select>
<input type="text" name="showValue1"><br>
</form>
</body>
</html>





now i need two to insert two value, in two text field together, when user choosing an option
for example : user clicking on option 1, then the textfield showValue1 will filled/fired with 1a,
and the the second textfield, lets say showValue2 will filled/fired with lets say 1b




i already tried added below in red, but its still not working

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="theform" onsubmit="CheckForm()">
<select name="myOptions" onchange="document.theform.showValue1.value=this.v alue &amp; document.theform.showValue2.value2=this.value2">
<option value="">Please select an option</option>
<option value="1a" &amp; value2="1b">1</option>
<option value="2a" &amp; value2="2b">2</option>
<option value="3a" &amp; value2="3b">3</option>
<option value="4a" &amp; value2="4b">4</option>
</select>
<input type="text" name="showValue"><input type="text" name="showValue2"><br>
</form>
</body>
</html>




please share your knowledge, how is the right code?
#drop #field #fields #make #populating #text

Trending Topics