AmpersandJS/ampersand-select-view — pull request #15 by nickryall (2014-10-23 09:54:45+00:00)
Title: Various updates

Apologies for the large pull request. I had been making these changes while working on a project and now am unsure how to submit the individual commits as requests. If you would prefer them as individual requests let me know and I'll manually break them up.

This pull-request contains the following.

1. Disable options by model attribute

When using a collection I needed a way to disable options based on a boolean attribute set in the model.

2. Return 'valid' if the the value is empty and the field is **not** set to 'required'.

If the select field is optional then the form should still submit if for example the default 'unselectedText' option is selected.

3. Set the name attribute on the select element with the passed in 'name' option.

If the select element in the markup does not have it's name attribute set. Use the name passed in through options.

4. Clear method

Resetting the form ( e.g. via a type="reset" button ) does not clear out the value set on the field. So I created a 'clear' method to do this manually. I suspect I may be missing something here though and there is probably an easier way to achieve this.

**Note:** I've done the same for ampersand-input-view and also a clearFields convenience method for ampersand-form-view which will call reset() on all child fields. If this is something that makes it in I'll submit the pull requests for these also.