How do I execute a method in a JSMethod variable?
When I use jsMethod.code it only returns the code and does not run it. How do I run the a method from a variable.
How do I execute a method in a JSMethod variable?
When I use jsMethod.code it only returns the code and does not run it. How do I run the a method from a variable.
erikd:
How do I run the a method from a variable.
What exactly are you trying to achieve?
jsMethod is basically the code which resides in a method.
so why not firing the method?
I got the answer to my question.
To execute the method from a variable, I called eval((method.getName() + “()”)) .
or
forms.formnamemethodname
jcompagner:
orforms.formnamemethodname
Thanks!
+1 Much better than eval
jcompagner:
orforms.formnamemethodname
Also don’t forget to check if it first exists
if(forms.formname[methodname])
forms.formname[methodname]()