mdSelect: error handling of mdSelect is inconsistent with mdInput
There is a couple of issues with current mdSelect error handling:
- Default error getter implementation for mdSelect does not take into consideration the $submitted property from parent form like mdInput does. This leads to inconsistent and confusing behaviour when submitting form containing select and input with errors.
- mdInput placeholder, border and message are red when the input has error. mdSelect error styling is applied only when dirty. This is inconsistent and confusing when using mdinput and mdSelect in the same form.
- mdSelect does not get the asterisk after the placeholder when required.
Demo can be found at http://codepen.io/anon/pen/wGeyem.
Tested with jQuery 2.2.2, Angular 1.5.2 and Angular Material 1.1.0-rc1.
I can provide a pull request with fixes for those issues, including tests, if this is going to help.
I am using Angular Material ^1.0.6 and I have a similar issue. The md-select and regular text input both have the required attribute.
- When the user leaves both fields blank and submits the form, the
ng-messageshows up for the textinputand not for themd-selectinput. - When the user clicks on the
md-select, theng-messageappears.- The
ng-messageappears even before the user chooses amd-option.
- The
- The
ng-messageappears even after choosing anmd-option.
I can confirm these issues occur using angular material 1.1.0-rc1 and angular 1.5.2. Has anybody figured out a temporary work around?
I will start working on PR for those issues.
Probably there is the same issue in md-checkbox too: http://plnkr.co/edit/iLYAHM55U1SRhxHNe7au
@montgomery1944 How do you plan to fix this? The input component prevents the from submit by the browser defaults. Select and Checkbox are custom elements.
Basically the form, can be submitted through:
<form name="test" ng-submit="test.$valid && ctrl.submitForm()">
This issue is closed as part of our ‘Surge Focus on Material 2' efforts. For details, see our forum posting @ http://bit.ly/1UhZyWs.