-
Notifications
You must be signed in to change notification settings - Fork 3.4k
validation errors in md-autocomplete #1780
Comments
made my own autocomplete component, which links ng-messages into it |
Just, I can do it too, but I would prefer to follow the "standard" way like the others inputs |
@javierpavon2000 I prefer that too, but the md-autocomplete is inconsistent with md-input, that's I really don't like. |
@hitigon Agreed on it's inconsistency with md-input. Seems like it is currently designed to resemble a md-select instead of a md-input. It looks really odd with other md-input elements around it. |
@hitigon @javierpavon2000 @bfelda I just added a styling option for use in standard forms: f487248 I will be adding validation support as well. |
A demo of the new styles can be seen here: https://material.angularjs.org/#/demo/material.components.autocomplete |
@robertmesserle awesome job! |
Proposed syntax for <md-autocomplete md-search-text="searchText" required>
<md-item-template>...</md-item-template>
<div ng-messages="searchText.$error">
<div ng-message="required">This field is required</div>
</div>
</md-autocomplete> |
Please, can you make some example with validations ? And what is md-item-template ? |
+1 for md-autocomplete validation example with md-item-template |
+1 with validation example |
+1 |
@robertmesserle This looks great! Thanks for implementing it. |
@bfelda this is going to be solved in 0.9.0? |
👍 |
1 similar comment
+1 |
At master, still no validation for md-autocomplete. The example doesn't work. |
Opened a new issue for this bug since it still appears to be broken: #3401 |
Even if you said it's required.... $error will always be empty. |
There's a bug with the documentation and example. Instead of 'md-input-name' the documentation says 'name' and the example says 'input-name'. |
@SergeyBukhman - to be clear, "name", "md-input-name", and "input-name" all do not work. |
|
Md-input-name does not work for me. Anyone have a plunk or codepen showing it working? |
+1. not working on 0.10.0. |
He's resolving it off issue #3401 |
md-input-name="autocompleteInputName" worked for me, you should attach the error to the input inside de md-autocomplete. |
This doesn't seem to be working in RC5 for 0.10.1 |
+1
My temporary solution was to add a hidden input with the same model as md-selected-item |
+1 |
@MetalHexx |
I haven´t got this to work and the one that is present in the DEMO page is also not working for the required field. I appreciate if anyone has an idea about it. |
Indeed, When seemingly doing everything right, the error message is shown from start, like @danieladz stated |
I realized I get more weird behavior when trying to have validations when the md-autocomplete is not inside a form. the example of having validation on the md-autocomplete, and using floating label, it is used inside a form. And they are using the name of the form when using ng-messages eg |
For me it's not working with version 1.0.1, am I the only one ? |
not working with version 1.0.6 if write required. |
It seems, the $dirty state does not work properly. Instead of focussing and unfocussing the input field, you need to type in something and remove it again. This is inconsistent compared to other input fields (and wrong as well). In addition, I have to add a seperate ng-show directive (which is different for default input fields, too).
Hans |
@haenig - please do not comment on closed issues. Please open a new issue. |
I want to configure a md-autocomplete input as required and show a message if not filled, but it's not working
if I inspect the formController object for the form, there isn't any object for autocompleteName
any hint? any help?
I just want to validate the md-autocomplete following as the same way of the inputs, is it possible?
The text was updated successfully, but these errors were encountered: