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

Hi twist! the first version with f

Status
Not open for further replies.

obtain

MIS
Dec 4, 2001
28
US
Hi twist!
the first version with form worked for changing
form[cr].value but couldn't set the new value for CoutTotale.

This last one I tried doesn't do any at all. Did I set it up wrong: Here's my changes:

function calcul(passedform)
{ thisform = document[passedform];
for(var i=0;i<thisform.nomb.value; i++)//set total for each row
{ var c13=&quot;text&quot;+i+&quot;13&quot;;
// document.write(c13);
var c17=&quot;text&quot;+i+&quot;17&quot;;
var c21=&quot;text&quot;+i+&quot;21&quot;;
//document.write(form[c13].value);
var r= parseInt(thisform[c13].value) + parseInt(thisform[c17].value) + parseInt(thisform[c21].value);
//document.write(r);
var cr =&quot;text&quot;+i+&quot;22&quot;;
form[cr].value =r;
}

var CombTotal=0;
for(var d=0;d<thisform.nomb.value;d++)//set total for each row
{ var cr =&quot;text&quot;+d+&quot;22&quot;;
CombTotal+=parseInt(thisform[cr].value);
}
//document.write(CombTotal);
var don ='CoutTotale';
thisform[don].value = CombTotal;
}
</SCRIPT>
 
hehe hi there, thats weird cause that works for me :)
lemme see what else i changed...

ohh yah, this was a bit messed up...
<form name=&quot;tapp&quot; action=&quot;savegs.php&quot; method=&quot;post&quot;>
 
and this should be you're script...



function calcul(passedForm) {
Thisform = document[passedForm];
for(var i=0;i<Thisform.nomb.value; i++)
//set total for each row
{ var c13=&quot;text&quot;+i+&quot;13&quot;;
// document.write(c13);
var c17=&quot;text&quot;+i+&quot;17&quot;;
var c21=&quot;text&quot;+i+&quot;21&quot;;
//document.write(form[c13].value);
var r= parseInt(Thisform[c13].value) + parseInt(Thisform[c17].value) + parseInt(Thisform[c21].value);
//document.write(r);
var cr =&quot;text&quot;+i+&quot;22&quot;;
Thisform[cr].value =r;
}

var CombTotal=0;
//set total for each row
for(var d=0;d<Thisform.nomb.value;d++){
var cr =&quot;text&quot;+d+&quot;22&quot;;
CombTotal+=parseInt(Thisform[cr].value);
}
//document.write(CombTotal);
var don = 'CoutTotale';
Thisform[don].value = CombTotal;
}
 
have it changed.. now looks just like yours in the source code but same result...did u have any other changes by any chance?
 
ok..now my textbox gets filled again for Thisform[cr].value but not for CoutTotale..
 
Twist,
Will take a look again in the morn,Thanks for your help and a good night to you!
 
Hey twist! Guess what? It works!!
It was just the name of my textbox that had name='CoutTotale&quot;' instead of 'CoutTotale'..no stray double quotes!
Thanks pal.
 
hehe i was just about to suggest that it could be some stray quotes since i saw lots last night, glad you got it working
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top