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

Added option to override change event #350

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added option to override change event #350

wants to merge 2 commits into from

Conversation

abe1001
Copy link

@abe1001 abe1001 commented Feb 20, 2015

Sometimes we need onChange on other events than 'change'. For example 'keyup'. This is useful when you want to validate while the user is typing the text. In this proposal you only have to add a "overrideInputEvent": "keyup" attribute to the field you want to give other input event than change.

@jdorn
Copy link
Owner

jdorn commented Feb 22, 2015

I like the idea. A couple things:

  • In general, I prefer using schema options for non-standard parameters instead of adding new schema keywords. So, something like this instead:
{
  "type": "string",
  "options": {
    "input_event": "keyup"
  }
}
  • Listening only on keyup has some problems. For example, right click paste and browser auto-complete does not fire keyup. Listening to both change and keyup fixes these issues. Maybe the code should always listen on change and there's a boolean option for also enabling keyup.

@abe1001
Copy link
Author

abe1001 commented Feb 23, 2015

I agree. I will create a new suggestion.

@jericmason
Copy link

Any update on the status for this request? The one problem I can see with the solution in the pull-request is that it only allows a single additional event to be included. This could be used to capture real-time key editing or real time copy-paste via mouse click, but it couldn't handle both possible ways the content may change in real time. I suggest that if this is to be included as a json schema field it should take the form of an array rather than single parameter.

{
  "type": "string",
  "options": {
    "input_events": [ "keyup", "click" ]
  }
}

@ghost
Copy link

ghost commented Jun 21, 2016

Any update regarding adding option to override change event

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.

3 participants