Plumsail Forms Checkbox - Restrict to 2 Selects only

I want to restrict multiple select checkbox to max 2 selects only.

Maximum 2 selects our of 5 checkboxes.

Is there any built in option for this ?

Hello @Ashnil_Sharma,

There is no built-in option for this, but you can add a custom validator to check how many options are selected and show the error message.

fd.field('FieldName').validators.push({
    name: 'MyCustomValidator',
    error: 'Error Message',
    validate: function(value) {
        if (value.length > 2) {
            return false;
        }
        return true;
    }
});