Re: [Proto-Scripty] Maybe OT: passing a function name to a function

2009-11-19 Thread bill
Alex McAuley wrote:
 Sorry i get what u mean now!..
  
 Example:
  
 function myFunction(options) {
 alert(options.id);
 eval(mySecondFunction);// Be very aware that evaluation is bad as JS 
 can be injected if you do not sanitise strings correctly
 }
  
 myFunction({id:1234,callback:'mySecondFunction'});
 // alerts 1234 then evals mySecondFunction();
  
  
 Not using eval EVER i cant remember if you need to add () or not... 
 but its a quick trial and error fix!!
  
 HTH
  
  
 Alex Mcauley
 http://www.thevacancymarket.com
Thanks Alex, together with TJ's reply I have plenty to chew on for now.
bill

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




Re: [Proto-Scripty] Maybe OT: passing a function name to a function

2009-11-18 Thread Alex McAuley
Not sure what u mean Bill...

Are you reffering to somehting like the onComplete of Ajax.Updater...

If so there is 2 ways to do it..

1. onComplete: myFunction (then somewhere else)

function myFunction() {
alert('i got called');
}

OR
2. (Anonymous Function)
onComplete : function() {
alert('I Got called');
}


HTH

Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: bill 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Wednesday, November 18, 2009 2:20 PM
  Subject: [Proto-Scripty] Maybe OT: passing a function name to a function


  I suspect this is not a prototype question, but then again, every time I turn 
around I am learning new capabilities of the framework.

  I need to pass a function name as an argument to a function for a call-back 
function.
  Do I just pass the function name as a quoted text argument ?
  If I do, do I need to eval the function when I want to execute it.

  or...

  what is the best way of doing this ?

  My apologies in advance if prototype does not have a nifty way of doing this 
and my thanks in advance for any suggestions.

-- 
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.
  For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.

--

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.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




Re: [Proto-Scripty] Maybe OT: passing a function name to a function

2009-11-18 Thread Alex McAuley
Sorry i get what u mean now!..

Example:

function myFunction(options) {
alert(options.id);
eval(mySecondFunction);// Be very aware that evaluation is bad as JS can be 
injected if you do not sanitise strings correctly
}

myFunction({id:1234,callback:'mySecondFunction'});
// alerts 1234 then evals mySecondFunction();


Not using eval EVER i cant remember if you need to add () or not... but its a 
quick trial and error fix!!

HTH


Alex Mcauley
http://www.thevacancymarket.com
  - Original Message - 
  From: Alex McAuley 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Wednesday, November 18, 2009 2:38 PM
  Subject: Re: [Proto-Scripty] Maybe OT: passing a function name to a function


  Not sure what u mean Bill...

  Are you reffering to somehting like the onComplete of Ajax.Updater...

  If so there is 2 ways to do it..

  1. onComplete: myFunction (then somewhere else)

  function myFunction() {
  alert('i got called');
  }

  OR
  2. (Anonymous Function)
  onComplete : function() {
  alert('I Got called');
  }


  HTH

  Alex Mcauley
  http://www.thevacancymarket.com
- Original Message - 
From: bill 
To: prototype-scriptaculous@googlegroups.com 
Sent: Wednesday, November 18, 2009 2:20 PM
Subject: [Proto-Scripty] Maybe OT: passing a function name to a function


I suspect this is not a prototype question, but then again, every time I 
turn around I am learning new capabilities of the framework.

I need to pass a function name as an argument to a function for a call-back 
function.
Do I just pass the function name as a quoted text argument ?
If I do, do I need to eval the function when I want to execute it.

or...

what is the best way of doing this ?

My apologies in advance if prototype does not have a nifty way of doing 
this and my thanks in advance for any suggestions.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.


  --

  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.
  For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.

--

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.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.