-
Notifications
You must be signed in to change notification settings - Fork 77
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
Reapplying the "works with inputs without the form-control class", but in a working fashion #37
base: master
Are you sure you want to change the base?
Conversation
Conflicts: src/showErrors.min.js
Hi @smebberson , this approach is an improvement, as it will work with more inputs, but is still sub optimal, as it won't work with any custom directives that act as inputs (have validators and attach to the form by name). My recommendation would be to have a method on the provider to specify a selector. It should default to .form-control[name] per bootstraps convention, but allow the developer to define their own convention on config. |
@xiphiaz, that's a fantastic idea! I'll see if I can find the time to squeeze it in. I'm don't use coffeescript that regularly either, but I'll see how I go. |
it also may be simplified to |
I think simplifying makes more sense because it adds support for radio buttons |
If anyone's interested (since it seems like this repo doesn't get much attention), @dgsmith2 appears to have implemented a generic selector that works with |
@@ -21,11 +21,11 @@ showErrorsModule.directive 'showErrors', | |||
showSuccess = getShowSuccess options | |||
trigger = getTrigger options | |||
|
|||
inputEl = el[0].querySelector '.form-control[name]' | |||
inputEl = el[0].querySelector 'input[name],select[name],password[name],email[name],datetime[name],datetime-local[name],date[name],month[name],time[name],week[name],number[name],url[name],search[name],tel[name],color[name],textarea[name]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't leave out the .form-control[name]
, because there may be other inputs (custom elements) that behave like form controls that you are missing now.
I had a look at the code added and then later reverted that allows this directive to "work with inputs without the form-control class". The code was fine but the query selector was a little too specific.
I made a fork of your repo,
git cherry-pick
ed e93c512acc619c179d191ae6692a17c6bcef50c5 and then made some amendments so that it works on a broader range of form inputs (including select).Would you consider using this code and reapplying the commit that was later reverted? I don't mind if you use this PR or not, but I would love for that code to make its way back into MASTER.
Let me know what you think.