Silksofthesoul/vue-m-validator

Unique

paparyku opened this issue · 2 comments

A suggestion.

add a "unique" field that pings a http route (say laravel / express) and checks if a email/username/whatever is taken.

Hello! In what form, would you like to transfer data to the server?

And...

how about this kind of function call?

      validator
        .addRule(RULE_1)
        .serverCheck({
          address: 'http://servername/validation',
          method: 'POST',
          data: {
             field1: 'usernameexample'
           }
        });

add a "unique" field that pings a http route

the plugin does not have "fields", in a conceptual form. You can independently send for validation the data that you need (and make them reactive if necessary), and set the verification rules on the client (please see the examples).

@paparyku Hello! I update package and documentation.
I hope the updated solution will be useful to you and other users (and maybe me 😃 )

For server communicate use 'serverCheck' method:

validator
  .addRule(RULE_1)
  .serverCheck(...see documentation...)

To use the new features, please update the package.
Run in commandline if you use npm:
npm update vue-m-validator