Although the .NET form script event handler "AfterOpen" can be used to retrieve data and prefill a form, it is only executed when a new form template is downloaded to an iOS or Android device, or web browser. ( This setting is available on the administrative web interface of the Mi-Forms Server by editing a form template and setting "run .NET AfterOpen event on sync" to Yes. )
In this example, see both JS form script and .NET form script. The following occurs:
1. MFAfterOpen will run whenever form is opened.
2. MFAfterOpen runs contactServer which sends a command "DateTimePlease" to the server...
On .NET based Server:
3. ServerContacted will accept the "DateTimePlease" command and return a server response accordingly.
4. The success callback function of the contactServer api will accept the server response and display the results.
Although the example simply retrieves the current date and time, the server-side code could possibly reach out to an internal resource such as a database.