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

Core: Add greaterThan and lessThan methods.#2061

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

Merged

Conversation

RobJohnston
Copy link
Contributor

Fixes#2030.

Tests are limited to integers, but I think that other data types would work too.

@Arkni
Copy link
Member

Thanks for the PR.

Looks good to me.

Can you also unbind the event and remove the class name invalidator#destroy() as done forequalTo method?

.find(".validate-equalTo-blur")
.off(".validate-equalTo")
.removeClass("validate-equalTo-blur");

As for testing the above request, you can do the same as the PR#1709

@RobJohnston
Copy link
ContributorAuthor

@Arkni So did I get it, or do I need to do some more studying of this repo?

@staabmstaabm requested a review fromArkniSeptember 16, 2017 08:49
$.validator.addMethod( "greaterThan", function( value, element, param ) {
var target = $( param );

if ( this.settings.onfocusout && target.not( ".validate-greaterThan-blur" ).length ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do we need this focus handling?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

My motivation was to follow the pattern of theequalTo method, and this was introduced there two years ago inCore: Bind theblur event just once inequalTo rule.

staabm reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just a clarification, the focus handling was added +5 years ago in this commitaca144b#diff-a692042a498ec7e201f38855d169e7b1R1163. The only thing that was added in the commit linked by@RobJohnston is binding the blur event one time.

Copy link
Member

@ArkniArkni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good to me.

@staabm
Copy link
Member

@RobJohnston do you have a actual use case for this newly added methods?

I am fine with adding them in case there is a need for it.
Only thing I dont like is the few lines added in core.js, but ok in case of a use case..

@RobJohnston
Copy link
ContributorAuthor

Yes I do. I have an application where people must record the inventory that they use, and each item in inventory has a serial number. At the end of the day, they have a range of consumed inventory, and this validation would ensure that the start serial number is less than the end serial number (or end is greater than start). If they only consumed one piece of inventory, then the end serial number has to be greater than or equal to the start serial number.

I thought it would be an easy PR to accept due to the previous discussion in#458 (comment).

@staabmstaabm merged commit38cb9b9 intojquery-validation:masterSep 19, 2017
@staabm
Copy link
Member

Thx for your detailed feedback

@staabmstaabm mentioned this pull requestSep 19, 2017
2 tasks
@RobJohnstonRobJohnston deleted the 2030-greaterThan-lessThan branchSeptember 20, 2017 00:40
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@staabmstaabmstaabm left review comments

@ArkniArkniArkni approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@RobJohnston@Arkni@staabm

[8]ページ先頭

©2009-2025 Movatter.jp