garygreen / dominar

Lightweight bootstrap validator inspired by Laravel
http://garygreen.github.io/dominar/
22 stars 4 forks source link

registerAsync example. #31

Open ovidius72 opened 7 years ago

ovidius72 commented 7 years ago

In the readme file the documentation for the registerAsync method is the following

Dominar.Validator.registerAsync('username_availability', function(username, attribute, parameters, passes) {.....}

I would like to pass some parameters to the newly registered method (username_availability in this example). The parameter I want to pass is not a static one, such as min:3, instead it will be a dynamic value, for example additional info about the current user.

I was thinking to something like this, but it's not working. The user.email value is not passed:

fieldA { rule: 'username_availability:' + user.email }

Can you please explain me how I can do that, if possible ? thx