4D v16.3WA Evaluate JavaScript |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.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:
This example of JavaScript code causes the previous URL to be displayed: $result:=WA Evaluate 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)
See also
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v11 SQL Release 2 ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||