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

  • basketmen
  • Student
  • Student
  • basketmen
  • Posts: 68

Post 3+ Months Ago

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



Quote:
<!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.value">
<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

Quote:
<!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.value [COLOR="#FF0000"]&amp; document.theform.showValue2.value2=this.value2[/COLOR]">
<option value="">Please select an option</option>
<option value="1a"[COLOR="#FF0000"] &amp; value2="1b"[/COLOR]>1</option>
<option value="2a"[COLOR="#FF0000"] &amp; value2="2b"[/COLOR]>2</option>
<option value="3a"[COLOR="#FF0000"] &amp; value2="3b"[/COLOR]>3</option>
<option value="4a"[COLOR="#FF0000"] &amp; value2="4b"[/COLOR]>4</option>
</select>
<input type="text" name="showValue">[COLOR="#FF0000"]<input type="text" name="showValue2">[/COLOR]<br>
</form>
</body>
</html>






please share your knowledge, how is the right code?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Satwant
  • Graduate
  • Graduate
  • User avatar
  • Posts: 127
  • Loc: Bangalore

Post 3+ Months Ago

Is this Work

HTML Code: [ Select ]
<!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.showValue.value=this.value; document.theform.showValue2.value=this.options[this.selectedIndex].text">
<option value="">Please select an option</option>
<option value="1a"  value2="1b">1b</option>
<option value="2a"  value2="2b">2b</option>
<option value="3a"  value2="3b">3b</option>
<option value="4a"  value2="4b">4b</option>
</select>
<input type="text" name="showValue" />
<input type="text" name="showValue2">
</form>
</body>
</html>
 
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Untitled</title>
  5. </head>
  6. <body>
  7. <form name="theform" onsubmit="CheckForm()">
  8. <select name="myOptions" onchange="document.theform.showValue.value=this.value; document.theform.showValue2.value=this.options[this.selectedIndex].text">
  9. <option value="">Please select an option</option>
  10. <option value="1a"  value2="1b">1b</option>
  11. <option value="2a"  value2="2b">2b</option>
  12. <option value="3a"  value2="3b">3b</option>
  13. <option value="4a"  value2="4b">4b</option>
  14. </select>
  15. <input type="text" name="showValue" />
  16. <input type="text" name="showValue2">
  17. </form>
  18. </body>
  19. </html>
  20.  

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 31 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.