Pop-up Error Message

Hello!

I would like to add this functionality to my form:

image

How would I go about the process to add this in my form? Any guidance would be appreciated!

Thanks in advance!

Hello @DryChips,

You can add a custom validation to disapply the error when a user enter invalid digit:

fd.field('Field1').addValidator({
        name: 'Custom validator',
        error: 'Enter valid card number',
        validate:function(value){
            var firstDigit = value.substring(0, 1);
            if(firstDigit != '5' || firstDigit != '3' || firstDigit != '4' || firstDigit != '6' ) {
                this.error = 'Card number must begin with a digit 3, 4 , 5 or 6'
                return false;
            }
            return true;
        }
});
1 Like