Can I execute methods from within Servoy fields?

Home for older / inactive topics

Can I execute methods from within Servoy fields?

Postby Jan Aleman » Wed Aug 04, 2004 10:30 am

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.
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Postby ahmad » Mon Aug 23, 2004 5:01 pm

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
Ahmad
Programmer
Pilot simple software
Hong Kong
ahmad
 
Posts: 139
Joined: Wed Dec 24, 2003 12:01 pm
Location: Hong Kong

Postby Jan Aleman » Mon Aug 23, 2004 5:10 pm

Presently you can only use globals.
You can reuse a globals if you need to set many.
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth


Return to Archive

Who is online

Users browsing this forum: No registered users and 0 guests

cron