Page 1 of 1

VFP ExecScript() similarly to Servoy

PostPosted: Sat Sep 17, 2011 10:47 am
by matthias_suck
Hello forum,

In the VFP there is the instruction EXECSCRIPT () gives it in the Servoy somewhat similarly to it.

For example:
I have a Tableview and if I click an entry and the following code are implemented.

Tablefield “bcode” has the following code:
(var myWindow = application.createWindow (" Supplier" , JSWindow.MODAL_DIALOG); forms.Supplier.controller.sh ow (myWindow);)

My function
function onFocusGained (event) {
// TODO car generated method stub
Var xbcode = ""
application.output (form.Favorit_Menue.bcode)
xbcode = form.Favorit_Menue.bcode
EXECSCRIPT (xbcode) ?????
return true
}

Greeting
Matthias

Re: VFP ExecScript() similarly to Servoy

PostPosted: Sat Sep 17, 2011 10:57 am
by ROCLASI
Hi Matthias,

JavaScript has the eval() function for this.
But usually it's frowned upon to use this because it's a security risk to use it since that external code that you don't have control over may do whatever.
Also it's slower since it's interpreted instead of compiled.

Re: VFP ExecScript() similarly to Servoy

PostPosted: Sat Sep 17, 2011 11:06 am
by matthias_suck
Hi,

Thank you for your fast answer.
Is exactly which I searched.

Greeting
Matthias

Re: VFP ExecScript() similarly to Servoy

PostPosted: Sat Sep 17, 2011 11:34 am
by Peter de Groot
This will also work,

var $script, $scriptObj;

$script = 'for(var i = 1 ; i <= 10 ; i++){application.output("Test")}';
$scriptObj = new Script($script);
var $d = $scriptObj();