[Proto-Scripty] evalScripts

2010-03-07 Thread bill

The script that loads the div is:

function scriptChain (evt, newDivID, chainToProgram, chainFromFormID) { 
// scriptChain
//alert (scriptChain:  + newDivID +  - + chainToProgram +  with 
+ chainFromFormID +);

stopBubble (evt);
// if chainFromFormID is blank, use a chain without data
if (chainFromFormID == )   { // no data
//alert (with no data);
closeMenu2 () ;  // no harm if it does not need to be closede
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 has as a fragment:
--
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

but when I call 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.


--
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.



[Proto-Scripty] evalScripts and functions

2009-05-25 Thread Michael

I understand how Prototype works with regards to the removal of
script tags after evaling the results of an Ajax request.  However,
I was doing some research and am now starting to wonder why the way I
declare functions works.

According to the Prototype documentation, you need to declare the
function and assign it to a global variable:

myFunction = function() {alert('hi');}

That makes sense.  However, in all of my scenarios, I've declared
functions like this:

var myFunction = function myFunction() {alert('hi');}

and the calls to myFunction work just fine.  My question is...why does
my way work?  According to the Prototype documentation, the local
variable myFunction should be thrown away after the eval.  Any insight
anyone can provide would be appreciated.  Thanks in advance!

--~--~-~--~~~---~--~~
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-scriptaculous@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
-~--~~~~--~~--~--~---



[Proto-Scripty] evalScripts problem

2008-11-13 Thread Ehsun

I've create an Object in my pages script tags, something like this:

a = new A();

and when I want to call a method of a in the script which is actually
the ajax content (evaluated with .evalScripts) everything is fine. but
when the creation and the calling code, both are in the ajax contents
(seperate requests) which are evaluated! the second script (calling
script) has no access to the object!!!

What should I do?

--~--~-~--~~~---~--~~
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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---