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

Populate form text boxes depending on value of a combo box?

Status
Not open for further replies.

Nottoobright

Technical User
Oct 10, 2001
17
0
0
GB
HI,
I have combo box with months in it and i want the user to select which month they are doing, from this i want to use a javascript function that will populate text boxes on the form with the individual dates and days that are specific to that month. How do i do it.
I am using the OnCLick event at the minuts using a button by the combo box and then i was going to use and IF statement to say if month is January then text1= tue 1st,text 2 = wed 2nd and so on. But it does not work.

Please any help would be much appreciated, I think my head is going to explode!!
 
<script language=&quot;javascript&quot;>

function insertDay(f) {
if (f.cmbMonth.options[1].selected == true) {
f.myTextBox.value = &quot;the text you want&quot;;
}
// and so on...
}

</script>


<form name=&quot;myForm&quot;>
<select name=&quot;cmbMonth&quot; onChange=&quot;insertDay(this.form)&quot;>
<option value=&quot;1&quot;>January</option>
.
.
.
<option value=&quot;12&quot;>December</option>
</select>

<input type=&quot;text&quot; name=&quot;myTextBox&quot;>

</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top