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

Created three events for input fields that are fired after validation. #4675

Closed
wants to merge 5 commits into from
Closed

Conversation

jmahc
Copy link

@jmahc jmahc commented May 10, 2017

Created two events that are fired after input field validation/invalidation.

  • 'materialize:valid-input' - event is fired when the input field receives the 'valid' CSS class.
  • 'materialize:invalid-input' - event is fired when the input field receives the 'invalid' CSS class.
  • 'materialize:reset-input' - event is fired when the input field has the 'valid' or 'invalid' CSS classes removed.

These events can be handled with the jQuery on method.

Valid:

$('#inputField').on('materialize:valid-input', function() {
  // handle a valid input field
});

Invalid:

$('#inputField').on('materialize:invalid-input', function() {
  // handle an invalid input field
});

Reset:

$('#inputField').on('materialize:reset-input', function() {
  // handle a reset of the input field
});

… that will fire when the input box receives a corresponding `valid` or `invalid` class on the form field.
@jmahc jmahc closed this May 10, 2017
@jmahc jmahc reopened this May 10, 2017
@jmahc jmahc closed this May 10, 2017
@jmahc jmahc reopened this May 10, 2017
@jmahc jmahc changed the title Created two events for input fields, 'materialize:valid' and 'materialize:invalid', that are fired after validation. Created three events for input fields, 'materialize:valid-input', 'materialize:invalid-input' and 'materialize:reset-input', that are fired after validation. May 10, 2017
@jmahc jmahc changed the title Created three events for input fields, 'materialize:valid-input', 'materialize:invalid-input' and 'materialize:reset-input', that are fired after validation. Created three events for input fields that are fired after validation. May 10, 2017
@Dogfalo
Copy link
Owner

Dogfalo commented Jul 6, 2017

Don't think these are that useful as you can do something very similar add a keyup handler and check the input itself or the class we've added

@Dogfalo Dogfalo closed this Jul 6, 2017
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

Successfully merging this pull request may close these issues.

2 participants