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

pass text value to a subsequent text box on same form using onBlur? 1

Status
Not open for further replies.

Jami

Programmer
Jul 18, 2000
54
US
Hi all,
I am attempting to send the value (if changed) of one text box to a later text box on the same form. I can update the subsequent text box with a predefined value that I send the function, but am I able to send the function the value of the text box that is linked to the onBlur event? Here is what I am attempting:

<form method=&quot;POST&quot; action=&quot;MountValuation2.cfm&quot; name=&quot;first_form&quot;>

<input type=&quot;Text&quot; name=&quot;mount_weight&quot; value=&quot;0.000&quot; size=&quot;10&quot; onBlur=&quot;writeIt('blur');&quot;>

<input type=&quot;Text&quot; name=&quot;adj_weight&quot; value=&quot;0.0000&quot; size=&quot;10&quot;>

</form>

Then, my function defined in the header is as follows:

<script language=&quot;JavaScript&quot;>
<!--
function writeIt(the_word)
{
var word_with_return = the_word;
window.document.first_form.adj_weight.value =
word_with_return;
}

// -->
</script>


I want the value of the adj_weight text box to have the same value as that of the mount_weight text box if changed by the user. Here, it changes to the word &quot;blur&quot;. Is this possible to manipulate the value of one text box based on the value of another on the same form?

Thanks so much!
Jami
 
Change your onBlur function to: &quot;writeIt(this)&quot;. Then change your writeIt function to writeIt(source). Then use this line: document.first_form.adj_weight.value = this.value;
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top