Recent changes to the FormView Control's API have been made to simplify passing data to Editors. FormView settings are now encapsulated inside the settings.formView namespace. This helps to reduce conflicts between user-defined settings and system settings. This change affects the settings['*a5column'] and settings.data objects.
Using settings.formView.active.path
Before, when getting the name of the field being updated to set a title, you could use settings['*a5column'] to fetch the field's name:
With the recent API change, you should use settings.formView.active.path instead:
Using settings.formView.active.target
Supported in Alpha Anywhere builds released on or after 12/21/2016:
For Group Editors, settings['*a5column'] was previously used to determine what field was selected so focus could be set to a specify control in the Group Editor. Unfortunately, you cannot use settings.formView.active.path to determine the selected field. settings.formView.active.path will be an array containing all of the fields that are assigned the Group Editor for editing.
To get the field that was clicked when the Group Editor was activated, use settings.formView.active.target. For example:
Using settings.formView.data
In the "Cascading Dropdownbox Editors" video demonstration, the settings.data object is used to determine what value to filter the City dropdown box by looking up the value of the State field. This is the code from the "Set value in editor":
With the new changes, this block of code becomes the following:
Existing UX components that use the FormView control are unaffected, however when building new Editors, you should use the new syntax.
This change to the FormView settings object was originally posted in the Pre-Release Notes.
Additional Resources
To learn more about the FormView control and Editors and Editor Sets, checkout the resources listed below:
The Basics
Creating Editors
Other Types of Editors
Using settings.formView.active.path
Before, when getting the name of the field being updated to set a title, you could use settings['*a5column'] to fetch the field's name:
Code:
[B][COLOR="#FF0000"]var title = settings['*a5column'];[/COLOR][/B] var eleTitle = $('EDITOR_2.FIELDLABEL'); eleTitle.innerHTML = title;
Code:
[COLOR="#FF0000"][B]var title = settings.formView.active.path; [/B][/COLOR]var eleTitle = $('EDITOR_2.FIELDLABEL'); eleTitle.innerHTML = title;
Supported in Alpha Anywhere builds released on or after 12/21/2016:
For Group Editors, settings['*a5column'] was previously used to determine what field was selected so focus could be set to a specify control in the Group Editor. Unfortunately, you cannot use settings.formView.active.path to determine the selected field. settings.formView.active.path will be an array containing all of the fields that are assigned the Group Editor for editing.
To get the field that was clicked when the Group Editor was activated, use settings.formView.active.target. For example:
Code:
[B][COLOR="#FF0000"]var control = settings.formView.active.target;[/COLOR][/B] control = 'EDITOR_3_' + control; var ele = {dialog.object}.getPointer(control); ele.select();
In the "Cascading Dropdownbox Editors" video demonstration, the settings.data object is used to determine what value to filter the City dropdown box by looking up the value of the State field. This is the code from the "Set value in editor":
Code:
if(settings['fieldName'] == 'State') { var choices = getStates(); } else if(settings['fieldName'] == 'City') { [B] [COLOR="#FF0000"]var state = settings.data.State;[/COLOR][/B] choices = getCities(state); } if(typeof choices != 'undefined') { {dialog.object}.populateDropdownBox('EDITOR_2_TXTBOX',choices,true); } {dialog.object}.setValue('EDITOR_2_TXTBOX',value);
Code:
if(settings['fieldName'] == 'State') { var choices = getStates(); } else if(settings['fieldName'] == 'City') { [B] [COLOR="#FF0000"]var state = settings.formView.data.State;[/COLOR][/B] choices = getCities(state); } if(typeof choices != 'undefined') { {dialog.object}.populateDropdownBox('EDITOR_2_TXTBOX',choices,true); } {dialog.object}.setValue('EDITOR_2_TXTBOX',value);
This change to the FormView settings object was originally posted in the Pre-Release Notes.
Additional Resources
To learn more about the FormView control and Editors and Editor Sets, checkout the resources listed below:
The Basics
- Introduction to the FormView Control: A discussion about the FormView, Editors, and Editor Sets.
Creating Editors
- Editors: Using a Dropdown Box: A discussion about how to use a dropdown box as an editor
- Editors: Cascading Dropdown Boxes: A continuation of a previous thread, Editors: Using a Dropdown Box, which covers how to implement cascading dropdown boxes within the context of tablet form Editors and Editor Sets.
- Editors: Pre-Defined List Control Editor: Dropping in a list control for editing data is made easier with the Editor-List. Learn how to leverage this control in your mobile apps.
- Editors: Populating a List from a SQL Query: Lists can be populated from a variety of sources. Discover how the onDialogInitialize event can be used to cache data to populate a List control Editor.
- Editors: Cascading List Control: Learn how to create a cascading List control Editor.
- Introduction to Group Editors: Learn how to edit a group of controls together using a Group Editor.
- Setting the Editor & Editor Set at Run-Time: Learn how to choose the Editor and Editor set to use at run-time using javascript.
Other Types of Editors
- Switch Editors: Discover how you can use an in-line switch to edit values instead of an editor set for binary and multi-value fields.
- FormView Image Capture: Learn how easy it is to capture images using the FormView control
Comment