Set Form Fields From Dictionary
Sets form fields to new values. The fields and their values are specified by a pass-in dictionary, where each dictionary key/value pair is a field denominator and a field value.
Note: The action assumes all fields belong to the same form.
True/yes if all fields could be found and set, false/no otherwise.
The input dictionary, i.e. the result of a native "Dictionary" action. Its keys specify which HTML element to target, and their values contain the new element values.
Dictionary key type
The dictionary keys specify the form fields to set. They can either be the fields'
id attributes, or CSS Selector.
Trigger "change" event
After setting a field's value, the HTML
change event can be fired on the field. Optional. This can be useful for search query fields with autocomplete or search-as-you-type functionality, for example.
Submit parent form
After setting the last field specified in the dictionary (and optionally firing its
change event), this HTML element's parent form should be submitted. This will be ignored if no enclosing parent form could be found.
Pause after setting values
Adds a delay after the last element was found and its value set. Optional, default is "no pause". If you want a pause greater than the maximum of 4 seconds, use a native "Wait" action.
Field types and value types
How the dictionary values are handled depends on the form field type. A value of type "dictionary" will always be changed into a JSON string, no matter the field.
A value of "1", "checked", "enabled", "on", "true", or "yes" will enabled the checkbox, anything else will disable it.
The radio button whose value matches the passed-in value will be selected.
Selects / multi-selects / dropdowns
The option whose value matches the passed-in value will be selected. If the passed-in value is a list, all matching options will be selected.
Any other field
The field's value will be set to the passed-in value.
Below you'll see a demo workflow which will open the Bootstrap Forms page, and start setting form fields. (I chose the page because it's nicely laid out.) After loading, it will …
- set the email address field to "email@example.com"
- set the first select/dropdown to "5"
- set the multi-selection field to "2" and "4"
- set the textfield to a JSON string (because nested fields aren't supported, and neither are dictionaries, they're just translated into a string)
Then, then second form is loaded, and a checkbox will be checked and the second radio button will be selected.
This should give you a good idea on how to get going with forms!