Terug naar overzicht

JS API

Aangepaste invoervalidatie

It is very easy to add your own custom validator. Lets say we only want to allow the text "test" in our input. Add the following code to your page to accomplish this.

let field = PeggyPay.getField("field");
field.addInputValidator(
    function(_field) {
        return _field.getValue() === "test";
    },
    "This value must be 'test'"
);