Call functions in custom template after form load and use global variables
Posted: 06 Jun 2018
Hi
i've a basic script in the form (using the "Javascript" button) with some global variables defined and some global functions.
I'm creating a custom namespace with "Type.registerNamespace('MyForm')".
Now i have some functions inside the "global" js (like onsubmit check).
And i have some fields that requiere custom rendering with additional javascript.
I want to use the functions and variables from the global JS and vice versa.
is this possible?
How to trigger the custom field js initiation after the global form js loaded?
for example:
i got a status-field that holding some numbers (1-4)
i got a global variable "MyForm.StatusValues = ["Start", "Waiting", "Approved", "Denied"]"
the status-field is a text field and i use custom template to render it as a dropdown.
After form loaded, i want to call the JavaScript form the custom field to fill up the select with the StatusValues from the global form!
I can put all JS inside the global JS from the form, but i want to split it up into the custom fields js for clarity
i've a basic script in the form (using the "Javascript" button) with some global variables defined and some global functions.
I'm creating a custom namespace with "Type.registerNamespace('MyForm')".
Now i have some functions inside the "global" js (like onsubmit check).
And i have some fields that requiere custom rendering with additional javascript.
I want to use the functions and variables from the global JS and vice versa.
is this possible?
How to trigger the custom field js initiation after the global form js loaded?
for example:
i got a status-field that holding some numbers (1-4)
i got a global variable "MyForm.StatusValues = ["Start", "Waiting", "Approved", "Denied"]"
the status-field is a text field and i use custom template to render it as a dropdown.
After form loaded, i want to call the JavaScript form the custom field to fill up the select with the StatusValues from the global form!
I can put all JS inside the global JS from the form, but i want to split it up into the custom fields js for clarity