Mixin: FormUtility

FormUtility

A mixin for simplifying some typical functionality inside Mortar's Form Components.
Typically only used internally to clean up Form components and reduce repeat code.

Source:

Methods


<private, static> _checkFieldIsValid()

_checkFieldIsValid

Source:
Returns:
Type
null

<private, static> _checkOptionEquality(first, second)

Simply checks to see whether or not the two values are truly equal

Parameters:
Name Type Description
first *
second *
Source:
Returns:
Type
boolean

<private, static> _findValueByPath(object, path)

Finds the value of a potentially deeply nested key in an object, and returns it.

Parameters:
Name Type Description
object object

a

path string

a

Source:
Returns:
Type
value
Example
var formResource = {user: {first_name: 'Kyle'}};
_findValueByPath(formResource, 'user.first_name'); // 'Kyle'

<private, static> _shouldRenderHelpBlock(helpText)

Checks to see if the help text for a component should be rendered, and handles rendering it.

Parameters:
Name Type Description
helpText string
Source:
To Do:
  • can this be removed?
Returns:
Type
jsx

<static> handleChange(event)

Handles changes to form components and handles setting state with the new value
as well as firing a change callback to set the field in the parent component.

Parameters:
Name Type Description
event event
Source:
Returns:
Type
null

<static> setValidationState(isValid, cb)

setValidationState

Parameters:
Name Type Description
isValid bool
cb function
Source:
Returns:
Type
null