Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed validation for named array within form validation (works for name="xyz" and name="xyz[]") both#2000

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

saurabhiam
Copy link

@saurabhiamsaurabhiam commentedApr 25, 2017
edited
Loading

Description

If a form input has a name="xyz[]" then only first element with name="xyz[]" is validated and rest are ignored.
This fix adds the flexibility for validating the named array (name="xyz[]") or a single name attribute (name="xyz") with no extra effort

Thank you!

@saurabhiamsaurabhiam changed the titleFixed validation for name array within form.Fixed validation for named array within form validation (works for name="xyz" or name="xyz[]")Apr 27, 2017
@saurabhiamsaurabhiam changed the titleFixed validation for named array within form validation (works for name="xyz" or name="xyz[]")Fixed validation for named array within form validation (works for name="xyz" and name="xyz[]")Apr 27, 2017
@saurabhiamsaurabhiam changed the titleFixed validation for named array within form validation (works for name="xyz" and name="xyz[]")Fixed validation for named array within form validation (works for name="xyz" and name="xyz[]") bothApr 27, 2017
@saurabhiam
Copy link
Author

Build is failing because of missing spaces after ( ) and a new line before comment. rest is fine

@gimler
Copy link

@Saurabh-Sharma i run into the same issue. Your patch works for me. why did you close this PR?

Saurabh-Sharmaand others added2 commitsJuly 11, 2017 12:27
If a form input has a name="xyz[]" then only first element with name="xyz[]" is validated and rest are ignored.
@saurabhiam
Copy link
Author

@gimler Reopened, need to update test cases

@saurabhiam
Copy link
Author

@cmcawood Here it is#2000

@aivilsaivils mentioned this pull requestMay 29, 2018
@stale
Copy link

stalebot commentedJun 5, 2018

This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up.
Thank you for contributing :)

@stalestalebot added the staleUsed to mark stale issues labelJun 5, 2018
@gimler
Copy link

still an issue the fix works

@stalestalebot removed the staleUsed to mark stale issues labelJun 6, 2018
@saurabhiam
Copy link
Author

Checks are failing due to test cases, which are expecting validation on single field. which is exactly not the case here.

>> validator - validating multiple checkboxes with 'required'>> Message: null>> Actual: 5>> Expected: 1>> file:///home/travis/build/jquery-validation/jquery-validation/test/test.js:1098:14>> events - validate multiple checkbox on click>> Message: null>> Actual: 2>> Expected: 1>> errors@file:///home/travis/build/jquery-validation/jquery-validation/test/test.js:1917:15>> file:///home/travis/build/jquery-validation/jquery-validation/test/test.js:1941:8>> events - validate radio on click>> Message: null>> Actual: 2>> Expected: 1>> errors@file:///home/travis/build/jquery-validation/jquery-validation/test/test.js:1976:15>> file:///home/travis/build/jquery-validation/jquery-validation/test/test.js:1994:8

@fansanelli
Copy link

@Saurabh-Sharma Hi,
I've applied you patch and it seems to workaround the issue without fixing it.
I suggest to add an "index" property in the "element" object using the jquery .index() method, then change the find-by-name function to accept it:
return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']:eq(" + index + ")" );
I'm not familiar with the validator code, but if you cannot give it a try I could to hack around my idea.
What do you think?
Cheers,
Francesco

@gimler
Copy link

1.18.0 still in issue. The PR works fine for me.

@bytestream
Copy link
Member

Closing in favor of#2498 - please comment on that PR if it doesn't work / match the behaviour of this PR.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ArkniArkniAwaiting requested review from Arkni

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@saurabhiam@gimler@fansanelli@bytestream@cmcawood@Arkni@Saurabh-Sharma

[8]ページ先頭

©2009-2025 Movatter.jp