Field validation
| Field | Description | Value |
|---|---|---|
| required | Marks a field as mandatory. | It accepts either a boolean value or an object with value and errorMsg as child props |
| pattern | Adds a pattern validation for the field. For email, pattern is supported by default | It accepts either a string value or an object with value and errorMsg as child props |
| min | For Textbox fields, it is the minimum number of characters required for the field, For number fields, it is the minimum value allowed | It accepts either a string or number value or an object with value and errorMsg as child props |
| max | For Textbox fields it is the maximum number of characters allowed. For number fields, it is the maximum value allowed | It accepts either a string or number value or an object with value and errorMsg as child props |
| info | This is for providing hints or more info about the field. Type is string | It accepts a string value |
| patternDetail (deprecated) | Contains info msg and error msg for pattern validation property | |
| minDetail (deprecated) | Contains error and info msg for min validation property | |
| maxDetail (deprecated) | Contains error and info msg for max validation property | |
| infoDetail (deprecated) | Contains general info msg about the field | |
| requiredDetail (deprecated) | Contains info msgs about the required validation property |
Note: Deprecated properties will not be supported in future releases.
Validation schema format
Requried validation
{
"validation": {
"required": true
}
}Requried validation with custom error message
{
"validation": {
"required": {
"value": true,
"errorMsg": "This is a custom error message"
}
}
}Pattern validation
{
"validation": {
"pattern": "^[A-Za-z]{1,32}$"
}
}Pattern validation with custom error message
{
"validation": {
"pattern": {
"value": "^[A-Za-z]{1,32}$",
"errorMsg": "The data pattern is not correct"
}
}
}Minimum and maximum characters validation
{
"validation": {
"min": {
"value": "3",
"errorMsg": "Password should be of minimum 3 length"
},
"max": {
"value": "20",
"errorMsg": "Password max length should be 20"
}
}
}Basic example
Schema details
{}
fields]
:
[[
…
][
…
]