Execution Context 在代码执行的时候定义了event context. 当form或者grid发生event时候传递了execution context. 可以在event handler中使用execution context执行各种tasks. e.g. 确定formContext, gridContext或者save event.
function DisplayHelloWorld(executionContext) {
var formContext = executionContext.getFormContext();
var firstName = formContext.getAttribute("firstname").getValue();
alert("Hello World " + firstName);
}
我们用execution context来获取form中的firstName.
首先打开我们之前的solutio -> contact -> form properties -> event handler (first name)
这里我们一定要勾选pass execution context as first parameter. 不然会出现js 报错.
save 并且publish
我们来测试一下结果