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

Integration with chosen #55

Open
masakik opened this issue Sep 14, 2016 · 3 comments
Open

Integration with chosen #55

masakik opened this issue Sep 14, 2016 · 3 comments

Comments

@masakik
Copy link

masakik commented Sep 14, 2016

Hi, I´m trying to use https://github.com/leocaseiro/angular-chosen to integrate chosen to my form. In the schema I have added attr: {"required":true, "chosen":""}. The normal behaviour works fine but if the field is not filled with an option the validation the js consoe throws an error: "An invalid form control with name='pessoas_id' is not focusable". Seems that it is because chosen modify the DOM and removes some control from autoFields. Do you have any tip on how to solve this?

@JustMaier
Copy link
Owner

Hey @masakik would you mind putting together a plunkr or something so that I can see what you have and modify it to work.

If you're not interested in sharing than my tip would be to look at implementing the chosen type as a custom handler so you can do something like type: 'select-chosen'

@masakik
Copy link
Author

masakik commented Oct 5, 2016

Hi, sorry for delay. I have done this plunkr. The issue is related to validating. If not set any value to the chosen select the validation do not show a popover like the no chosen select. Beside that it works perfectly.

@JustMaier
Copy link
Owner

@masakik the validation message that you mentioned is actually being generated by the browser. The reason it's not appearing for the chosen field is because chosen hides the original select field so the browser doesn't know how to display the validation message, hence this error:

An invalid form control with name='chosen' is not focusable.

That's also why autofields validation messages don't show either. To fix this I'd suggest creating a type handler for chosen, that way the validation message appear around that instead of around the hidden select field.

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

No branches or pull requests

2 participants