-
Notifications
You must be signed in to change notification settings - Fork 45
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
Validating Select elements does not work correctly #75
Comments
@jackmatt2 What Ember/HB do you use? for me a select validation works just fine on the property level ( no need property.id) |
I am using [email protected] which includes:
I should have mentioned that I am binding the selection to a DS.Model using my pull request. I guess that may be the issue here. It would be good if the
The following is currently supported by {{view "select"
content=programmers
optionValuePath="content.id"
optionLabelPath="content.firstName"
value=currentProgrammer.id}} The following is not supported: {{view "select"
content=programmers
optionValuePath="content.id"
optionLabelPath="content.firstName"
selection=selectedPerson}} I will almost always use the second syntax where I bind the selection to a DS.Model. If I am incorrect here and there is actually a way to bind directly to the selected model please enlighten me. |
Fair enoug Lets support this on the upcomming release |
@asaf OK cool. Can you give me any idea of your release cycle? The reason being I will try to put off working with the library until support for this is added. |
@asaf I actually think my pull request should change a little. I think ember forms should follow the property : Ember.computed.alias('value') The reason is that currently ember-data models require '.content' as part of the property for an async relation. I hard coded this into the code but there are cases where you are using a selection that is not binding to an ember-data model. I propose that ember-forms does what Ember.Select should do and actually correctly resolve .content property. see here
The above would allow the user to switch between a Ember Data model with something else without modifying their template code (This is an exact issue I am having with some generic code I have created whereby sometimes it is an ember-data model an other times it is a regular Ember.Object) So if you had a person property you could bind to it in the following ways:
|
does not work on a select element. you need to use.
but then the validaition message does not appear because the path is now pointing to the id instead of the status property. The submit button will however remain disabled as expected using the second syntax as it correctly determines that the model is invalid.
This appears to be due to the fact that we need to bind to the
.content
property when an item is selected.The text was updated successfully, but these errors were encountered: