Dynamic error style password field accounts-core in Meteor

40 Views Asked by At

I am using accounts-core package in meteor to make my registration form in my application.

I configure own custom validation field in password. i.e.

var password = AccountsTemplates.removeField('password');
AccountsTemplates.addField({
    _id: 'password',
    type: 'password',
    required: true,
    displayName: 'Password',
    re: /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$/,
    errStr: 'At least 8 characters, 1 uppercase, 1 lowercase and 1 number'
});

Now i want to show error message with different style according to what character user missed to type. Something like:

enter image description here

As per Documentation : Field Configuration we need give errStr when field is configured.

And we can write func for custom validation:

AccountsTemplates.addField({
    ...
    func : function(pwd){
        ...        // check your password
    }
    ...
});

But How can i pass dynamic markup to show error message?

0

There are 0 best solutions below