formBuilder v2.1.1

Widgets

All widgets are created using jQuery UI's Widget Factory and they inherit all of the options, methods, and events of the base widget.

formBuilder

Base form widget. For many applications, this is the only widget needing direct use. Other field widgets are created automatically and handled inside of this widget.

inputField

Builds a base input object that is able to get, set, and modify data based on what the type of the input is.

inputFilter

Filters through the input in the inputField and, based on the type of the input, validates that it has been entered correctly. If incorrect input is typed it will not allow the input to be entered or displayed.

submitButton

Widget that handles the creation of a submit button and the spinner that accompanies it. The submit button can be clicked and the spinner will be displayed while the data is being submitted.

fieldWidget

Available to be modified in order to accept new types that the user wishes to develop. Many of these methods are intended to perform in a similar way as methods in the inputField widget but they can be overwritten by user if desired to meet specific requirements. This template is stored inside of inputField widget and commented out. See example.

selectionField

Handles checkboxes and radio buttons, allowing them to be used like inputFields with formBuilder features. Only radio buttons will have a radioGroup attatched to .

arrayField

Creates an array of inputFields and other widgets and can perform methods on the array as a whole, including validation and clear. The array field should contain one type of input field and can have as many or as few inputs as the user desires. The arrayField widget will create an array of the data that is contained within each of the inputFields within it. Attribute Options - data-nosort - Optional. Items are not sortable and do not have a .sort-handle Methods (public) - getId() Return the id of the current calling object. - isDirty() Returns current dirty value (true/false). - getFieldInstances() Returns an array of field instances. - get() Returns an array of the data in the current arrayField. - validate() Calls inputField.validate() to validate the input in the array field, returns true/false if arrayField is valid or not. - clearDirty() Resets the current dirty status to false. - clear() Resets the calling object to an empty array. - flash() Calls the inputField.flash() to flash the error message to the screen. - set(data) Appends a new item, set with the data that is passed into the method, to end of the array. - addItem(integer index, item) Adds a new item to the location of the index passed into the method, if no index is defined then append to the end of the array. - drawItem(item) Draws the item based on its template and whether or not it is a subwidget. - subFieldMarkup() Returns the subField. Methods (private) - _create() Creates the arrayField based off of the template that the user wishes to apply and fills out the appropriate elements. - _handleAddButtonClick() If the 'beforeaddnewitem' event has been triggered then call addItem(). - _checkDirty() Determines whether the data-dirty is supposed to be true or false in that moment of typing. - _onDirty() Will return if dirty, otherwise will call _checkDirty(). - _onClean() Performs the same function as _onDirty(). - _empty() Clears the array and calls the children's destroy methods. - **_drawInternalMarkupItem(item, template itemView) Called when the item is not a subwidget. Triggers 'beforeadd' event. Draws it and wraps it with the appropriate html and parents. - _drawWidgetItem(item, template itemView, widget subWidget) Called when the item is a subwidget. Triggers 'beforeadd'. Draws the subwidget inside of the relevant widget. - _destroy()** Removes everything from the array and returns it to its original state. Events - beforeadd Optional. Triggered before adding an item that is not a new item. - beforeaddnewitem Optional. Triggered before a new item is added to the array, prepares the array for a new item. - afteradd Optional. Triggered after adding an item to the array to ensure that the array has handled adding the item correctly. - afterdelete Optional. Triggered after deleting an item from array to make sure that array has handled deletion correctly.

dropDownPanel

Drop down panel widgets may be used to add an extra hovering container to any element. Drop downs are shown when a user clicks on the target element, and/or focuses (if possible) on the focusTarget element. They can be hidden by clicking outside of the drop down, or the target element, or by pressing the escape key. Drop downs are inserted after the target and as a result, will move up and down the page with the element when scrolling.

dateRangePicker

Creates two input fields for a beginning and ending date. Allows the user to select different ranges of dates if they wish to. Based off of the date data-type.

dateTimeRangePicker

Similar to the dateRangePicker widget in that it creates two input fields for a beginning and ending date, but also has a field for each input that allows the user to include a time range as well which is based off of the dateTime data-type.

popOver

Creates a popOver that can be appended to the inputField and can have data and links inside of it. Uses the tooltip class and expands upon it. The user can set the title and data of the popOver and it will open on focus.

textSubmitter

Similar to an instant messager box. The user can type text and then hit enter to trigger a submit event with the data and a callback. Once submitted the textbox is cleared and ready for new input. A send instruction message appears when focused.

spin

Creates a spinner that will be displayed when the submit button has been clicked and will spin until the data is properly submitted.

Input Types

In order to access a specific type method outside of inputField, you must first access the type instance by calling inputField('getType') on the inputField widget element.

Note: The ifw parameter is an instance of the inputField widget a type is attached to.

standard

There are a general set of methods that every type must contain in order to function properly as a type. They can be modified to suit that type's needs and there can be additional methods, but these ones below are the minimum required.

select

Instead of using the normal select tag, you can use an input tag with data-type="select". It has the basic elements of a select tag, but with more functionality. When clicked, a dropdown appears with sorted option labels (which are scrollable vertically and horizontally) for the user to choose from. It also has a search box the user can use to quickly find a label by typing in what they are searching for.

date

The date data type is created to have an inputfield that allows the user to enter a date, either by typing the date directly into the inputfield, or by picking a date from a datepicker tooltip that will open when the user clicks on the inputfield. For valid offset syntax, see the Date Offsets guide.

time

The time data type is created to have an inputfield that allows the user to enter a time, either by typing the time directly into the inputfield, or by picking a time from a timepicker tooltip that will open when the user clicks on the inputfield.

dateTime

dateTime is a data type that is a combination of the two inputfields, date and time. The original inputfield is hidden between these two types.

money

Data type used to allow for the input of monetary amounts into an inputfield. Allows the user to type amount into the inputfield but if they type an incorrect value it will not allow anything to be entered.

phone

Data type that allows for the input of phone numbers. Filters to ensure that input is in correct format.

Plugins

caret

Manages the display and positioning of the caret. Determines where the beginning and ending point should be if the input has been changed through filtering or formatting. Also organizes positioning when part of the input text has been highlighted.