Appearance framework for adaptive and HTML5 forms appearance-framework-for-adaptive-and-html-forms
Forms (adaptive forms and HTML5 forms) use jQuery, Backbone.js and Underscore.js libraries for appearance and scripting. The forms also use the jQuery UI Widgets architecture for all interactive elements (such as fields and buttons) in the form. This architecture enables Form developer to use a rich set of available jQuery widgets and plug-ins in Forms. You can also implement form-specific logic while capturing data from users like leadDigits/trailDigits restrictions or implementing picture clauses. Form developers can create and use custom apperances to improve the data capture experience and make it more user-friendly.
This article is for developers with sufficient knowledge of jQuery and jQuery widgets. It provides insight into the appearance framework and enables developers to create an alternate appearance for a form field.
The appearance framework relies on various options, events (triggers), and functions to capture user interactions with the form, and responds to model changes to inform the end-user. In addition:
- The framework provides a set of options for the appearance of a field. These options are key-value pairs and divided into two categories: common options and field type specific options.
- The appearance, as a part of the contract, triggers a set of events such as enter and exit.
- The appearance is required to implement a set of functions. Some of the functions are common while others are specific to field type functions.
Common options common-options
The following are the set global options. These options are available for every field.
Apart from these options, the framework provides some other options which vary depending on the type of field. The details for the fields-specific options are listed below.
Interaction with forms framework interaction-with-forms-framework
To interact with forms framework, a widget triggers some events to enable the form script to work. If the widget does not throw these events, some of the scripts written in the form for that field do not work.
Events triggered by widget events-triggered-by-widget
APIs implemented by widget apis-implemented-by-widget
The appearance framework calls some functions of the widget which are implemented in the custom widgets. The widget must implement the following functions:
Options specific to type of field options-specific-to-type-of-field
All custom widgets should conform to the above specifications. To use the features of different fields, the widget has to conform to the guidelines for that particular field.