lboeldt
Posts: 53
|
Posted: 07/07/2010, 12:41 PM |
|
Hi JSMonkey,
Make sure the ID of each textbox is set to TextBox1, TextBox2, TextBox3 to match the field's name.
In your header check to make sure prototype.js is included in a script tag if not place the following tag just below the <head> tag.
<script language="javascript" src="/js/pt/prototype.js"></script>
<script language="javascript>
function recalcTextBoxes() {
// Make sure both boxes have a value
if ( ( $("TextBox1").value != "" ) && ( $("TextBox2").value!="" ) {
// if both boxes have a value calculate for box 3
$("TextBox3").value=$("TextBox1").value+$("TextBox2").value
}
}
</script>
Put recalcTextBoxes in the on change event for textbox1 and textbox2.
When either box changes the new total is re-calculated provided both boxes are filled.
Let me know if this helps. If this fulfills your request, please mark this thread as resolved by adding [resolved] to the title. Thanks.
|