chartpacs wrote:How might I pass multiple parameters to a method? I was thinking of adding more text to the button name, using some designated character as a delimiter. However, the only character that seems to work is '$'. I'm not sure why--does the dollar sign have special meaning in JavaScript?
Anyway, I guess I could start naming buttons like:
btn$parameter1$parameter2$parameter3$...etc. and then convert this string into an array using the split() function.
What I've been doing is to create a global variable with my parameter(s). (The parameter can be a single value, a delimited list, an array.) If that variable is named myParameters, name the button btn_myParameters, and replace out the "btn_" string as needed to refer to the contents of the variable in your method.
Silly example ... with a global variable named myParameters, containing the single value "boo", and a button named btn_myParameters ...
- Code: Select all
plugins.dialogs.showInfoDialog( "My Dialog",utils.stringReplace(application.getMethodTriggerElementName(),"btn_",""),"OK");
(scary how easy it was, huh)
At first I thought I missed the button param's of FMP. But when you're working in ScriptMaker you *cannot see* what the button parameters are (unless you go through the script with debugging on and use the data viewer).
But in Servoy, by separating the value of the parameters from the physical button on the form by using this method, you gain two big advantages:
1. Easy to re-use the parameter definition in other ways/places
2. Can see what the parameter is while coding your method
kazar