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

refresh textbox value

Status
Not open for further replies.

xenomage

Programmer
Jun 27, 2001
98
SG
hi,

been trying all morning to use the onchange event to place data on a textbox without having to refresh the page.

can anyone help me on this?? Or is it possible at all??

Thanks
 
Hello,
Try
<form name=&quot;myform&quot; method=&quot;post&quot;>
<select name=&quot;sel&quot; onchange=&quot;this.form.tShow.value = this.form.sel[this.form.sel.selectedIndex].value&quot;>
<option value=&quot;<option value=&quot;</select>
<input type=&quot;text&quot; name=&quot;tShow&quot; value=&quot;&quot;>
</form>

D.
 
Thanks. But i can't use this because i need to pass the index value of the combo box to another function for evaluation and then place the result on the textbox.

Think you can help me agaiN??

Many thanks.
 
Hello,
In case you are using JavaScript, see below:
<HTML>
<HEAD>
<TITLE> Select </TITLE>
<script language=&quot;JavaScript&quot;>
function validate(index,val,txtbox) {
alert(index);
// do some validation
// if ok
setTxtbox(val,txtbox);
//else do something else
}
function setTxtbox(val,txtbox){
txtbox.value = val
}
</script>
</HEAD>

<BODY>
<form name=&quot;myform&quot; method=&quot;post&quot;>
<select name=&quot;sel&quot; onchange=&quot;validate(this.form.sel.selectedIndex, this.form.sel[this.form.sel.selectedIndex].value, this.form.tShow)&quot;>
<option value=&quot; selected>Webcrawler</option>
<option value=&quot;</select>
<input type=&quot;text&quot; name=&quot;tShow&quot; value=&quot;&quot;>
</form>
</BODY>
</HTML>

Or you could post your code/ link to it/ to see what is wrong there.

D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top