miguelcobain / ember-paper

The Ember approach to Material Design.
http://miguelcobain.github.io/ember-paper
MIT License
889 stars 332 forks source link

PaperSelect does not clear errors when a new option is selected #1132

Closed lucasmerat closed 4 years ago

lucasmerat commented 4 years ago

In when I pass in errors, I get an error state, but when I select an option, that error state is not cleared.

On the it seems that the error is cleared once some content is typed into the field.

Is there another property I should be passing in that I am missing?

Here is the code:

<PaperSelect
    @selected={{@level}}
    @searchEnabled={{false}}
    @options={{this.levelOptions}}
    @onChange={{action (mut @level)}}
    @label="Level *"
    @errors={{@errors.level}}
    @isTouched={{true}}
    class="w-full mb-0 mt-0"
     as |levelOption|
>
  <p class='w-56'>{{levelOption}}</p>
</PaperSelect>

Here's an image showing a selected item with the error state still active

Screen Shot 2020-03-10 at 12 51 33 PM
lucasmerat commented 4 years ago

Realizing now that we hand-rolled a wrapper on paper input to make these errors clear when the input is touched again.

Going to do the same with paper select, but this might be a nice feature across ember paper

miguelcobain commented 4 years ago

The way to do this is to use customValidations. That should be an array with a message and a validade property. When validate function returns true, message is applied.

errors is supposed to be a property given to the component to show errors directly.