Page 1 of 1

Can I execute methods from within Servoy fields?

PostPosted: Wed Aug 04, 2004 10:30 am
by Jan Aleman
Yes you can. Use an html_area, set it to non-editable and then it can trigger Servoy methods by using html links.

Example:
Put this in the html area:
Code: Select all
<html>
<a href="javascript:dialog_test("hi")">click here to run script</a>
</html>


You can pass arguments to your methods, in the example above we are passing "hi" to the method we are calling. In the method you are calling you can parse out the parameters. Create a method name dialog_test with the following contents:

Code: Select all
var receivedArgument = arguments[0]
plugins.dialogs.showInfoDialog( "Info","The argument you passed is: " + receivedArgument )


It will show a dialog with the arguments you passed it.

PostPosted: Mon Aug 23, 2004 5:01 pm
by ahmad
Hi,

Can I use labels to trigger a script instead of using the global fields?

I placed a label/button on the form. I entered the html text in text property of the label. But it seems the method is not triggered.

But when I use global fields as per the instructions in this post the method is triggered.

I'm just wondering to avoid creating lot of global fields for these things (I have so many buttons where I need to use HTML). I think it would be easier if we can simply enter the HTML in the text property of a label/button

Am I going stupid???

Thanks

PostPosted: Mon Aug 23, 2004 5:10 pm
by Jan Aleman
Presently you can only use globals.
You can reuse a globals if you need to set many.