Namespace: FormHelperResponse

FormHelperResponse

This describes the expected format of a FormHelperRequest JSON response
Properties:
Name Type Attributes Description
status String Custom status code for the request. Form Helper will try to make visible any elements within the form having a class matching the pattern js-fh-status-{status}. Optionally maps to a FormRule.StatusHandler for additional logic
data <optional>
Arbitrary data. Typically HTML or additional JSON data
errors Array.<FormHelperResponse.RequestError> <optional>
Any errors and metadata for the request
Source:

Examples

{
  "status": "ERROR",
  "errors": [
    {
      "code": "pw-too-short",
      "message": "password must be at least 8 characters",
      "params": [
        "password",
        "password-confirm"
      ]
    },
    {
      "code": "incomplete-address",
      "message": "missing address fields",
      "params": [
        "city"
      ]
    }
  ]
}
{
  "status": "SUCCESS",
  "data": "<div>Thank you!</div>"
}

Type Definitions

RequestError

Type:
  • Object
Properties:
Name Type Attributes Description
code String User defined error code. Form Helper will try to make visible any elements within the form having a class matching the pattern js-fh-error-{code}
message String <optional>
Developer-only details and/or description of the error. Not used by Form Helper
params Array.String <optional>
Array of request parameters, i.e. form inputs, that are associated with the RequestError
Source:
Example
{
  "code": "login-failure",
  "message": "Email address and/or password invalid",
  "params": [
    "email-address",
    "password",
    "password-confirm"
  ]
}