Vee-validate: New rule for name fields

Created on 24 Oct 2016  ·  12Comments  ·  Source: logaretm/vee-validate

Hello,

It would be interesting, a new type of rule. It is for a daily and very common need. I believe it is feasible to release a rule for the name field type, which are accepted only letters and spaces, nothing more.

What do you think!?

Most helpful comment

Yea I guess I can add alpha_space as - like you said - is very common, should be implemented today.

All 12 comments

Yea I guess I can add alpha_space as - like you said - is very common, should be implemented today.

Thank You!

Which version will have available the rule "alpha spaces"?

The latest tags should have it for both versions (2.0.0-beta.14 and 1.0.0-beta.9)

I have a last version (beta 14):

npm http request GET https://registry.npmjs.org/vee-validate
npm http 304 https://registry.npmjs.org/vee-validate
[email protected] /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0
└── [email protected]

But, errors occur:

vee-validate.js?d4ab:1583 Uncaught TypeError: validator is not a function
    at Validator._test (eval at <anonymous> (http://localhost:8080/app.js:2562:2), <anonymous>:1583:25)
    at eval (eval at <anonymous> (http://localhost:8080/app.js:2562:2), <anonymous>:1427:37)
    at Array.forEach (native)
    at Validator.validate (eval at <anonymous> (http://localhost:8080/app.js:2562:2), <anonymous>:1426:44)
    at ListenerGenerator._inputListener (eval at <anonymous> (http://localhost:8080/app.js:2562:2), <anonymous>:1892:32)

captura de tela 2016-11-04 as 10 07 14

I am using the "alpha_spaces" rule.

That is weird, are you sure you don't have a typo?

this fiddle uses the latest version: https://jsfiddle.net/h32qekps/

It's working so. I must have done something wrong.

We have another question now: In Portuguese, we use accented characters for names.

I would be happy to take a look if you send me the relevant parts of your project.

So you are saying that the alpha rules don't support non-english characters, I can fix that since I will be switching to the validator.js soon.

However sometimes names contain characters other than alpha and spaces.

It should be alpha, spaces, hyphens, and apostrophes.

@eberkund I guess you are right, we only added the alpha_spaces to be a basic form of it and that it is needed most of the time, it seems like names can have a huge range, you can use the regex rule in the meantime.

@logaretm I have ran into the same question. I think a name rule would be of great use. A rule that would allow alpha, spaces, hyphens, and apostrophes (and maybe even a few numbers).

True, in the meantime we can use regex for that purpose, but I think having a universal rule for such common use-case would be ideal and much more readable. 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kidox picture kidox  ·  3Comments

jagasan picture jagasan  ·  3Comments

schel4ok picture schel4ok  ·  3Comments

the94air picture the94air  ·  3Comments

saintplay picture saintplay  ·  3Comments