0

given this code

<div class="form-group">
  <label class="control-label" for="stateCode">StateID</label>

 {{view Ember.Select
    contentBinding="controllers.state.content"
    optionValuePath="content.state"
    optionLabelPath="content.stateName"
    valueBinding="stateCode"
    class="form-control"
   disabled=isNotEditing
 }}

<div class="form-group">
  <label class="control-label" for="country">Country</label>
{{input type="text" value=country class="form-control" placeholder="Country" disabled=isNotEditing}}
</div>

the fields all show as disabled. However, when I toggle the isNotEditing property then only the {{input fields are enabled. The {{view Ember.Select field is still disabled.

Is there something else that I need to do to toggle a {{view Ember.Select disabled state ?

thanks

jmls
  • 2,879
  • 4
  • 34
  • 58

1 Answers1

1

Instead of using disabled, you should used disabledBinding. When you set disabled directly it's the same as statically assigning a single value that does not change (the value of isNotEditing and view instantiation). I'm not sure why using disabled works for inputs but not for selects. It might be a bug with the inputs...

Here's a jsbin : http://jsbin.com/ucanam/968/edit

Jeremy Green
  • 8,547
  • 1
  • 29
  • 33
  • thanks so much! this was driving me mad. I can confirm that changing **disabled=isNotEditing** to **disabledBinding="isNotEditing"** works for both my text and selects. Thanks again. – jmls Sep 10 '13 at 15:01
  • one little question, if you don't mind : is there an ember equivalent of the [link]( http://stackoverflow.com/questions/6865943/html-form-select-option-vs-datalist-option) – jmls Sep 10 '13 at 15:30
  • Hey, jmls, it's possible to use `datalist` in an Ember app, but it takes a little doing. If you'll open another question about this I can give you an explanation and an example. (Only so many words allowed in comments...) – Jeremy Green Sep 10 '13 at 15:44
  • question posted at [link](http://stackoverflow.com/questions/18724155/can-a-datalist-be-used-with-ember-js-select) – jmls Sep 10 '13 at 16:22