4D v14.3WA Evaluate JavaScript |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
WA Evaluate JavaScript
WA Evaluate JavaScript
The WA Evaluate JavaScript command executes, in the Web area designated by the * and object parameters, the JavaScript code passed in jsCode and returns the result. By default, the command returns values as strings. You can use the optional type parameter to specify typing for the value returned. To do this, pass one of the following constants, found in the "Field and Variable Types" theme:
Important: Handling complex type results (objects, dates, etc.) is only possible if the Web area uses the integrated Web Kit as the rendering engine. This example of JavaScript code causes the previous URL to be displayed:
$result:=WA Execute JavaScript(MyWArea;"history.back()") This example shows a few evaluations with conversion of the values received. JavaScript functions placed in an HTML file: <!DOCTYPE html> <html> <head> <script> function evalLong(){ return 123; } function evalText(){ return "456"; } function evalObject(){ return {a:1,b:"hello world"}; } function evalDate(){ return new Date(); } </script> </head> <body> TEST PAGE </body> </html> In the 4D form method, you write: If(Form event=On Load) You can then evaluate the JavaScript code from 4D: $Eval1:=WA Evaluate JavaScript(*;"Web Area";"evalLong()";Is LongInt)) |
PROPERTIES
Product: 4D
HISTORY
SEE ALSO
WA EXECUTE JAVASCRIPT FUNCTION ARTICLE USAGE
4D Language Reference ( 4D v14 R2) Inherited from : WA Execute JavaScript ( 4D v11 SQL Release 6) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||