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

FormView model for selected option does not always get updated #187

Closed
pepperbc opened this issue Jan 28, 2016 · 2 comments · Fixed by #281
Closed

FormView model for selected option does not always get updated #187

pepperbc opened this issue Jan 28, 2016 · 2 comments · Fixed by #281

Comments

@pepperbc
Copy link

Example:

    <select {{bindModel 'serviceType'}}>
      <option value="{{defaultOptionValue}}">
        {{i18n "default"}}
      </option>
      {{#each serviceTypes}}
        <option value="{{id}}">
          {{name}}
        </option>
      {{/each}}
    </select>

The preceding code iterates over the "serviceTypes" collection, creating an option for each item. If this collection changes, the select/options are properly redrawn. If the currently selected option is removed from the collection, the first option in the select is selected, but the form model is not updated with the value of this option.

Repro steps:

  1. Create a formView with a select with options backed by a collection
  2. Bind model.selectedItem to the select
  3. Select an item from the dropdown
  4. Remove the selected item from the backing collection
  5. The top item of the select is now selected
  6. model.selectedItem should have the value of the top item, but still has the value of the deleted item
@kentmw
Copy link
Contributor

kentmw commented Apr 6, 2016

Does this have anything to do with #176 or #84

@pepperbc
Copy link
Author

pepperbc commented Apr 6, 2016

I think it's a separate issue - it's possible it may be fixed when #84 is done, but not certain.

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

Successfully merging a pull request may close this issue.

2 participants