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

Event-Handlers #345

Closed
jannickfahlbusch opened this issue Apr 10, 2015 · 11 comments
Closed

Event-Handlers #345

jannickfahlbusch opened this issue Apr 10, 2015 · 11 comments

Comments

@jannickfahlbusch
Copy link

I read the docs but didn't found anything regarding handlers on the fields like onBlur(), onFocus() or something.

Do i haven't seen it, or is this functionality not implemented yet?

@davidlgj
Copy link
Contributor

Hi @jannickfahlbusch! The docs covers nearly everything, at least everything that is supported. There is onChange for some fields but no other events as of now. What is your use case?

@jannickfahlbusch
Copy link
Author

I would use it, to register functions to these events.

I want to execute some actions inside of a function, when i'm leaving/entering a field and so on

@davidlgj
Copy link
Contributor

Sure, but what is the use case? What is the problem you are trying to solve?

@jannickfahlbusch
Copy link
Author

I need to execute a function check() when the user has blurred the field.

check() will dynamically add or remove fields, depending on the input of the user.

@davidlgj
Copy link
Contributor

I'm not sure if or when we'll implement support for more events, I guess I'd like to do it some other then adding a lot of ng-* to the templates.

In the meantime I suggest you listen to onBlur events from the form the old fashioned way with an ordinary event listeners :) Don't forget to broadcast a schemaFormRedraw event and issue a $apply() after you've changed the form.

@subhendupsingh
Copy link

Exactly what event should i listen to?? I have tried "onBlur","ng-blur","ngBlur","blur" but no success.

Moreover is there a way to broadcast schemaFormValidate and get back the result without any changes on the UI, like validation errors,success etc.

Use Case: I want to set form autosave on blur (or after 2 seconds of inactivity whichever is possible), only when the madatory fields are filled, otherwise nothing happens.

@subhendupsingh
Copy link

Allright!

Any thoughts on this:

Moreover is there a way to broadcast schemaFormValidate and get back the result without any changes on the UI, like validation errors,success etc.

@davidlgj
Copy link
Contributor

davidlgj commented May 5, 2015

@subhendupsingh by "old fashioned way" I was referring to ordinary DOM Events, i.e using jQuery or by addEventListener.

schemaFormValidate forces a validation on all fields just so that the UI changes, but the default behavior is to validate a field on change so you can always just check the state of the form controller.

@murrutia8k
Copy link

Hi, I'am using onchange with a input date, but I need the function was executed when I loose focus (onBlur) in the field, not always when change... supose I need to change date from 2017-08-12 to 2017-08-11... But the function is executed for 2017-08-1 (when I delete the last "2" character) and then when I complete date to 2017-08-11.

Any news about other events? I need to resolve this issue as commented before : "by "old fashioned way" I was referring to ordinary DOM Events, i.e using jQuery or by addEventListener."?

Thanks for your comments.

@seseso
Copy link

seseso commented Oct 20, 2017

Hi,
You can add the option "ngModelOptions": { updateOn: 'blur' } in the filed you want to listen in the event onBlur...

@murrutia8k
Copy link

murrutia8k commented Oct 23, 2017 via email

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

No branches or pull requests

6 participants