When an HTML form in a remote browser or embedded HTML window is submitted, a vizhtml.FORM_SUBMIT_EVENT is generated. The event can be handled using either a task or callback function.
Task functions, from the viztask library, are useful for controlling program flow. Use the following command to create a viztask condition that waits for a form submission:
Command |
Description |
vizhtml.waitFormSubmit() |
Waits until a form submit event occurs. The yielded command returns a viz.Data object that holds the form data. |
The names of properties in the returned data object match the names of input fields in the HTML form. For example, if the HTML form contains a text field named occupation:
the code below would store the value from that field after the form is submitted:
Use the command below to register a callback function for a form submission event:
Command | Description |
vizhtml.onFormSubmit(func, *args, **kw) | Registers a callback function for a form submission event:
func: The function being registered. An event object e, holding form data, will be passed to this callback function.
*args: Optional arguments to pass to the registered function.
**kw: Optional keyword arguments to pass to the registered function. |
The names of properties in the event object e passed to the callback function match the names of input fields in the HTML form. For example, if the HTML form contains a text field named occupation:
the code below would store the value from that field after the form is submitted: