mac validator

Validate a MAC address

Options

Use with form field

The HTML attributes are used to set the validator options via the Declarative plugin

Name HTML attribute Type Description
message data-fv-mac___message String The error message

Use with JavaScript module


// You might need to change the importing path
import mac from 'formvalidation/validators/mac';

const result = mac().validate({
    value: ...,
    options: {
        message: ...,
    },
});
/*
result is an object of
{
    valid: true or false,
    message: The error message     
}
*/

Related validators

The following validators are similar to this one and might be useful to you.

Name Description
ip Validate an IP address. Support both IPv4 and IPv6
uri Validate an URL address