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

Missing Support for input[type="radio"] and select #1

Open
srsgores opened this issue Dec 1, 2014 · 10 comments
Open

Missing Support for input[type="radio"] and select #1

srsgores opened this issue Dec 1, 2014 · 10 comments

Comments

@srsgores
Copy link
Contributor

srsgores commented Dec 1, 2014

I noticed validation is missing for these inputs. Are there any plans of implementing?

@bakura10
Copy link
Member

bakura10 commented Dec 1, 2014

Regarding select and radio I suppose you are talking about a required validator. iirc this should work, no? I don't have any of those in my app, but I will add some to try it out and check if I can add support for it :)

@bakura10
Copy link
Member

bakura10 commented Dec 9, 2014

Support in select have been added in #4

@ghost
Copy link

ghost commented Aug 4, 2015

Hi guys,

seems like support for select boxes is still not completely working.

My markup looks like:

<div class="form-control">
  <select {{action 'change' on='change'}} required={{required}}>
    {{#each content key="@index" as |item|}}
      <option value="{{item.id}}" selected={{eq item.id selected}}>
        {{item.description}}
      </option>
    {{/each}}
   </select>
</div>

This markup is inside a component, which gives several params (eg. content, required) to the select box.

In case that "required" is true, i expect that the plugin will validate the select and put an error class on the form-control if no option is selected, but it does not. I am using Ember 1.13.4 with Ember-CLI 1.13.1.

Any solutions for that?

@bakura10
Copy link
Member

bakura10 commented Aug 4, 2015

Hi @tmaynx ,

I'm not doing any EmberJS work for now so unfortunately I won't be able to provide an immediate fix, but feel free to submit a PR for that.

Normally, the requirement to work is to make sure that you have an option whose value is empty (value=""). Is that the case?

@ghost
Copy link

ghost commented Aug 5, 2015

Hi @bakura10,

that is unfortunate, but nevermind, I'll see what I can do =)

Problem is that I currently have no idea how I can fix the issue. Seems that the validation listener is not even registered on my select box. If I extend my component (which one contains the select box) with validation mixin, it can't find an appropriate input respectively select element.

To answer your question: The rendered output has an option whose value is empty, requirements are fulfiled here.

@bakura10
Copy link
Member

bakura10 commented Aug 5, 2015

Hi,

Ha, ok. I see what happen. You are actually using the tag directly, and not the Select view: http://emberjs.com/api/classes/Ember.Select.html If you use the select view it will work, however I know there is less flexibility in that. If I rmemeber correctly the Select view is kinda deprecated in Ember but currently this is the only way to make the validation triggered on select. For now, the philosophy of this library has been to have a completely drop-in solution: just use the standard input component, select view... and it will do the validaiton. However this is way less flexible (hard to format errors the way you want, for instance), so I think that in the future, we'll need to use our own component, like {{validatable-input}}...

@ghost
Copy link

ghost commented Aug 6, 2015

I see. Unfortunately i can't use the Ember Select view, because we don't want to have any deprecations in our project. That means I have to find a way to trigger the validation on my select element without using the view.

Thank you for your support and the explanations so far. I'm send you a PR when I have figured it out =)

@bakura10
Copy link
Member

bakura10 commented Aug 6, 2015

After checking more it seems that the {{view "select"}} is not deprecated in 1.x branch

Envoyé de mon iPhone

Le 6 août 2015 à 08:12, Thomas May [email protected] a écrit :

I see. Unfortunately i can't use the Ember Select view, because we don't want to have any deprecations in our project. That means I have to find a way to trigger the validation on my select element without using the view.

Thank you for your support and the explanations so far. I'm send you a PR when I have figured it out =)


Reply to this email directly or view it on GitHub.

@srsgores
Copy link
Contributor Author

srsgores commented Aug 6, 2015

How about the ember-x-select add-on?

@bakura10
Copy link
Member

bakura10 commented Aug 6, 2015

Yeah, sounds like a nice idea. Anyway I'll wait until we have EmberJS 2, there are a lot of new featuers that may be of interest to such a library like this one!

bakura10 pushed a commit that referenced this issue Aug 11, 2015
bakura10 pushed a commit that referenced this issue Aug 11, 2015
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