ErrorMessageInterface
Fields available on ErrorMessageInterface.
| Property | Type | Required |
|---|---|---|
message | `string \ | number \ |
type | string | optional |
code | number | optional |
data | `null \ | string \ |
Usage
Example: Handling an Error Message using the Validate API function
const myForm = document.getElementById("myForm");
nfsfu234FormValidation.validate(myForm, (response) => {
/**
* Example of using the ErrorMessageInterface
*
* Here the response is in the ErrorMessageInterface formart so we destructure the ErrorMessageInterface
* This enables us to to access its attributes and use them easily
*/
const { message, type, data, code } = response;
console.log("Code: ", code);
console.log("Message: ", message);
console.log("Type: ", type);
console.log("Data: ", data);
});Used by
Last updated on