Pardon me if this has been seen/replied to, apparently I am not getting
all the mail from the group
When I load a div using AJAX.updater that contains a script
and then call the script, recalc(), I get the error message: recalc is
not defined.
thoughts/suggestions please
where did I go wrong ?
These are old scripts that I am using in the rewrite of an application,
but should work.
The script that loads the div is:
--------------------------------------------------------
function scriptChain (evt, newDivID, chainToProgram, chainFromFormID) {
// scriptChain
stopBubble (evt);
// if chainFromFormID is blank, use a chain without data
if (chainFromFormID == "") { // no data
document.getElementById (newDivID).style.display = "block";
new Ajax.Updater(newDivID, chainToProgram, {
evalScripts:true
});
return false; //inhibit the href
} //no data
else { // with data
new Ajax.Updater(newDivID, chainToProgram, {
parameters: $(chainFromFormID).serialize(true),
onFailure: function(response) {
alert ("patient.php: failure to submit form: " +
chainFromFormID);
},
evalScripts:true
});
return false;
} //with data
} // scriptChain
---------------------------------------------------------------
and works fine
The page that I am loading contains
------------------------------------------------------------------
<SCRIPT type="text/javascript">
window.reformat = function (t,d) {
var bal = ( Math.round((t.value * 100) + .4))/100.0;
t.value= FormatNumber(bal,2)
return true
}
window.recalc = function (t,d){
reformat(t,d);
//then recalc amount remaining
var bal = t.form.amount.value
bal -=t.form.amount1.value
bal -=t.form.amount2.value
bal -=t.form.amount3.value
bal -=t.form.amount4.value
bal -=t.form.amount5.value
bal -=t.form.amount6.value
t.form.amount_remaining.value = bal
reformat(t.form.amount_remaining,2)
if (t.form.amount_remaining.value< 0.0) { // error
alert ("ERROR, you can not distribute MORE than the amount of
the payment")
}
}
</script>
------------------------------------------------------------
--
Bill Drescher
william {at} TechServSys {dot} com
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.