Skip to content

Latest commit

 

History

History
39 lines (36 loc) · 1011 Bytes

setMessageHandler.md

File metadata and controls

39 lines (36 loc) · 1011 Bytes

setMessageHandler(rule, createMessage)

Sets or replaces the current message handler for the specified rule.
You will get a message created with the handler if includeMessages option is true

Parameters

Name Description
rule:string The rule to set the message handler for. E.g "required|image"
createMessage:function A function which handles message creation.
E.g: fieldData => `${fieldData.name} is required`
Where fieldData will be in the form of:
{// E.g { key: 'username' validation: 'between:3,10', value: 'nik-m2' }
  key: [fieldName],
  validation: [rules],
  value: [value],
  // Will include any extra properties on field that are
  // given to validateForm. E.g "label" key
}