Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callback function return wrong errors object if there is no "id" attribute specified in input field #185

Open
toanqc opened this issue Mar 21, 2016 · 2 comments

Comments

@toanqc
Copy link

toanqc commented Mar 21, 2016

Hello,
Thank you for your great work.

I found out the small issue which is if I don't specific the "id" attribute for input field, the errors object will be returned with wrong format. The length of the errors object will always return 1 even if more than 1 errors for this validator. And all the error messages will be added to the first error.messages array.

i.e
I have 6 required input fields with only specify "name" attribute but not "id" attribute. When I submit the
errors object return
{
length: 1
messages: Array[6] { /* include all error messages */}
}

Solution:
Please add the "id" attribute to the documentation... or modify the code make it work without id attribute

Thanks,

@petervukovic
Copy link

Confirmed.

  1. When I submit an empty form with this markup:

`




`
  1. and the following set of rules:
var validationRules = [
    {
        name: 'name',
        rules: 'required'
    },
    {
        name: 'email',
        rules: 'required'
    },
    {
        name: 'password',
        rules: 'required'
    }
];

The error object will appear like this: http://prntscr.com/akalih

Expected:

The error object should contain three individual error objects for each invalid field.

@pixel-fixer
Copy link

Confirmed.
I think, this is pretty unusable, when you need to specify id for each field, especially if there are more than 1 same form on the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants