Modules: enhanced-redux-form

Members


ValidationConfig :object

Type:
  • object
Properties:
Name Type Argument Description
validateOn string | Array.<string> <optional>

A string or array of strings that specifies on which event the validation should trigger. See ValidateOn.js for possible values.

validators Array.<module:enhanced-redux-form~ValidationRule>

An array of validation rules to test this field for.

Source:

ValidationRule

Properties:
Name Type Argument Description
rule function

A function that returns true or false for valid or invalid. May also return a promise that resolves with true or false. It will receive the following arguments:

  • value The current value of the field
  • values An object containing all the values in the form
  • name The name of the field that is being validated
message string | Object <optional>

A message that should be set as error message when this field is invalid. Can be either a string, or an object with the following properties:

  • locale The id of the locale string to lookup
  • params (optional) The MessageFormat parameters to pass to the locale string
code string <optional>

A unique string to identify the error. Can be used to implement custom error messages

Source:

Methods


enhancedReduxForm(reduxFormConfig [, Object])

Returns a function that wraps a component in enhanced-redux-form functionality. Syntax is similar to the reduxForm() method of redux-form:

const MyEnhancedForm = enhancedReduxForm(reduxFormConfig, validation)(MyForm);

Parameters:
Name Type Argument Description
reduxFormConfig Object

The configuration object that will be passed to redux-form. The enhanced configuration object allows the following additional properties:

Properties
Name Type Argument Description
wizard Object <optional>

If passed, indicates that this form is part of a multi-step wizard form

Properties
Name Type Argument Description
index number <optional>

The index of this step in the wizard

route string <optional>

The route that this form will be available under. When an error occurs in the submission, we will navigate to this route

transformApiFieldNames string <optional>

A function that maps each field name in an API validation response to a field name in this form. Can be used to map flattened field names in the API back to nested names in redux-form.

Object <optional>

validation The validation configuration object. The keys of this object correspond to names of fields in the form, and the values are the corresponding validation configs.

Source:
Tutorials:
Returns:

The function that wraps a component in an enhanced component with enhanced-redux-form functionality

Type
function