new Formalizer()
Main Formalizer class constructor
Methods
(private, static) _activeGrp()
Set the current group to display
(private, static) _chckRowCom(row, name, fields)
ROW INPUT Check the row component type, this will then delegate to the correct method for creating the row element
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
name |
String | The row name reference |
fields |
Object | The fields object for the group |
(private, static) _checkEmail(name, value, result, custErr)
Determines if a given string is empty
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the field |
value |
String | The field input value |
result |
Array | Result array |
custErr |
String | The custom error message for the field validation |
(private, static) _checkEmpty(name, value, result, custErr)
Determines if a given string is empty
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the field |
value |
String | The field input value |
result |
Array | Result array |
custErr |
String | The custom error message for the field validation |
(private, static) _checkMatch(name, value, result, custErr)
Determines if 2 values match, specifically for password confirmation type fields
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the field |
value |
String | The field input value |
result |
Array | Result array |
custErr |
String | The custom error message for the field validation |
(private, static) _checkMaxMin(name, value, max, min, result, custErr)
Determines if a given value is greater than max or less than min
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the field |
value |
String | The field input value |
max |
Number | Max value |
min |
Number | Min value |
result |
Array | Result array |
custErr |
String | The custom error message for the field validation |
(private, static) _checkNotify(values)
Check if there are any notifications set and dispatch
Parameters:
Name | Type | Description |
---|---|---|
values |
Object | The user inputs data object |
(private, static) _checkValues()
VALIDATE Initialize the validation for the form fields, this will determine if EMPTY values are permitted, which by default they are not in validation this should also check for maximum and minimum values
(private, static) _clearWarnings()
REMOVE WARNING - Remove the warning elements that were added to the do
(private, static) _crteButs()
Create a form element based on the element type
(private, static) _crteChckbxEl(row, opts, name)
Create a group of checkbox elements based on the options
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteChckGrdOpts(row, opts, values, name)
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
values |
Object | The values to populate the options with |
name |
String | The row name reference |
(private, static) _crteChckGrid(row, opts, name)
Create a group of checkbox elements based on the options
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteCheckGrp(row, opts, values, name)
Create a group of checkbox elements based on the options
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
values |
Array | An array of values for the checkbox |
name |
String | The row name reference |
(private, static) _crteDateSelCom(row, opts, name)
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteFileCom(row, opts, name)
Creates the password component which is a component that has 2 password fields form confirnmation and an optional strength check analysis
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteGrd(parent, name, attributes, data)
Create a list grid that users can select item from, the first row has a checkbox to allow for selection
Parameters:
Name | Type | Description |
---|---|---|
parent |
HTMLElement | The row or component container to append the element to |
name |
String | The name reference of the element |
attributes |
Object | The attributes for the element |
data |
Object | The data object for the row |
(private, static) _crteGrpEl(grp, fields)
CREATE GROUP ELEMENTS Create the group elements, the elements that should be present in one group
Parameters:
Name | Type | Description |
---|---|---|
grp |
HTMLElement | The group element reference |
fields |
Object | The fields object for the group |
(private, static) _crteInputEl(row, opts, name)
Create a new input element, this will configure the creation of standard input type element such as the "text" "password" "radio" "checkbox"
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crtePwordCom(row, opts, name)
Creates the password component which is a component that has 2 password fields form confirnmation and an optional strength check analysis
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteRadioGrp(row, opts, name)
Create a group of radio elements based on the options
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteRowEl(grp, name, fields)
CREATE ROW Create a new form row which has the default left and right element to control positioning of the form row elements and labels
Parameters:
Name | Type | Description |
---|---|---|
grp |
HTMLElement | The group element reference |
name |
String | The row name reference |
fields |
Object | The fields object for the group |
(private, static) _crteSelectDateOpts(row, opts, name)
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteSelectEl(row, opts, name)
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteSelectOpts(row, opts, name)
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _crteTextareaEl(row, opts, name)
Parameters:
Name | Type | Description |
---|---|---|
row |
HTMLElement | The row element reference |
opts |
Object | The options for the element |
name |
String | The row name reference |
(private, static) _encodeData(inputData)
Encode the formdata to base64
Parameters:
Name | Type | Description |
---|---|---|
inputData |
Object | The form data object |
(private, static) _fileChange()
File changed event handler
(private, static) _formSubmit()
Handle the form submit action button press, this will determine if the field values required validation and the submission method to use
(private, static) _formSubmitPost()
Overrides the default submit action for a
(private, static) _getElements()
Returns an object with the default html elements added
(private, static) _getGrdChkVal(row, row, vals, data)
GETS and SETS the user inputs for the checkboxes
Parameters:
Name | Type | Description |
---|---|---|
row |
String | The row identifier |
row |
HTMLElement | The row element |
vals |
Object | The vals object to set the values in |
data |
Object | The user input data object |
(private, static) _getInputs()
GET INPUTS - Use this to loop through and find the component types and either GET or SET the data for the component/input
(private, static) _getInVal(row, row, vals, data)
COMPONENT CHECK VALUES - The following methods GET or SET values for the designated components
Parameters:
Name | Type | Description |
---|---|---|
row |
String | The row identifier |
row |
HTMLElement | The row element |
vals |
Object | The vals object to set the values in |
data |
Object | The user input data object |
(private, static) _hdleCancel()
Handle the cancel button click, this will execute the callback so that an action can be performed on the container of the form
(private, static) _hdleNotify()
Handles the notify action for the element value change events which are supplied in the options configuration on initialization
(private, static) _initialize()
Initialize the component
(private, static) _initValidate()
VALIDATE Initialize the validation for the form fields, this will determine if EMPTY values are permitted, which by default they are not in validation this should also check for maximum and minimum values
(private, static) _nextGrp()
Handle the next button press, this will increment the current group and execute the activeGrp function
(private, static) _prevGrp()
Handle the previous button press, this will decrement the current group and execute the activeGrp function
(private, static) _pwordChange()
Password changed event handler
(private, static) _removeEvents()
Remove the events for formalizer component
(private, static) _removeNotifyEvents()
Removes any notification events that have been bound to elements
(private, static) _render()
Render the component element, this method can be called any number of times if the data for the component is added again
(private, static) _setData(inputsOnly)
Set the data for the form based on the data supplied when the component is initialized
Parameters:
Name | Type | Description |
---|---|---|
inputsOnly |
Boolean | Defines that only the inputs should be updated |
(private, static) _setElOpts()
SET OPTIONS - This will set the option data for RADIO GROUPS, SELECT elements CHECKBOX GROUPS and other components that have configurable options
(private, static) _setEvents()
Set the events for the select menu
(private, static) _setNotifyEvents()
Sets the notification events for any elements that require it
(private, static) _showWarnings()
WARNING - Show the warnings on the form by adding the "invalid selector" to the form elements
(static) destroy()
Destroy the component and remove all elements from the dom and clear all events added, returns a null value in the event the object was stored in a reference to nullify the reference
(static) disable()
Disable the form items, this will disable all fields from input
(static) enable()
Enable the form items, this will enable all fields for input
(static) update(data)
Update the select list
Parameters:
Name | Type | Description |
---|---|---|
data |
object | The data object to update with |