Constructor
(abstract) new CommonFormFunctions()
Create CommonFormFunctions.
- Source:
Methods
(static) appendStyle(element, style) → {boolean}
Append inline style to a DOM object
Parameters:
| Name | Type | Description |
|---|---|---|
element |
element | A dom element to be emptied. |
style |
string | A style to be appended. |
- Source:
Returns:
- Return true if append was possible or false if element or syle is not defined.
- Type
- boolean
(static) draggablePlugin_interact(data)
jQuery draggable plugin, requires interact.js
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | Define draggable behaviour.
Properties
|
- Source:
- See:
(static) draggablePlugin_jQuery(data)
jQuery draggable plugin, requires jQuery Draggable
Parameters:
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | Define draggable behaviour.
Properties
|
- Source:
- See:
(static) draggableSnippet(data) → {mixed}
A generic function to make items draggable using any plugin defined.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | Define draggable behaviour.
Properties
|
- Source:
Returns:
- Returns plugin function result.
- Type
- mixed
(static) empty(element) → {number}
Strip a DOM element of all its children.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
dom | A dom element to be emptied. |
- Source:
Returns:
- A number of child elements deleted.
- Type
- number
(static) filterProperInputTypes(type) → {string}
Confirm passed input type by returning it or default to the text.
Supports only the ones defined in the HTML standard.
More about input tag on Mozilla Developer Network
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | Input type to be checked. |
- Source:
Returns:
- Return the same input type passed or default to "text" if there was no match.
- Type
- string
(static) getElementPosition(element) → {Object|boolean}
Get DOM element's top, right, bottom and left borders, optionally counting in margins.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
dom | A dom element to have the borders measured. |
- Source:
Returns:
- An object containing all DOM element positions, with keys: top, left, right, bottom - or false if no element was passed.
- Type
- Object | boolean
(static) getElementPositionUsingjQuery(element) → {Object|boolean}
Get DOM element's top, right, bottom and left borders, counting it its margins, width and height.
Requires jQuery to run!
Parameters:
| Name | Type | Description |
|---|---|---|
element |
dom | A dom element to have the borders measured. |
- Source:
Returns:
- An object containing all DOM element positions, with keys: top, left, right, bottom - or false if no element was passed.
- Type
- Object | boolean
(static) joinStrings(stringA, stringB, delimiteropt) → {string}
Join two strings together.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
stringA |
string | First string. | |
stringB |
string | Second string. | |
delimiter |
string |
<optional> |
A delimiter to divide the two string parts. Default is comma. |
- Source:
Returns:
- Return the two strings joined, using the default or passed delimiter.
- Type
- string
(static) postData(url, data) → {Promise}
Post passed data to a specified url
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | Specify URL to submit the data to. |
data |
string | Data to be submitted. |
- Source:
Returns:
- A promise for the XMLHttp submit request
- Type
- Promise
(static) triggerEvent(eventElement, eventName, eventDataopt) → {boolean}
Call to trigger an event on a DOM element with passed name and optionally data.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventElement |
element | A dom element for the event to be called on. | |
eventName |
string | A name for the to-be-called event. | |
eventData |
string | Object |
<optional> |
An optional attribute containing string or object with additional data to be passed to the event. |
- Source:
Returns:
- Return true if event creation was sccessful or false ig no eventElement was passed.
- Type
- boolean