-
Notifications
You must be signed in to change notification settings - Fork 27.5k
input directive does not update html5 native validation. #5500
Comments
One of my patches tries to do this sort of (at least for type=number), although it doesn't make any calls to |
this should be simple to implement for everything using ngModel directive. We should just update the validity state somewhere in $setValidity method of the only tricky thing that will require some experimentation is to make sure that by setting that property we don't trigger some native form behavior that would interfere with existing user interface (native browser validation popovers etc). |
Yeah that's what I was thinking. From there you easily have access to the element and the validationErrorKey. I believe the submit event must be called for validation to take place so setting the property won't trigger any changes to the UI until the submit event has been raised. I don't see many side effects as some attributes (min, max) would be causing this already unless the form has the novalidate attribute on it. This change would make the experience more consistent so that all validation will cause HTML5 validation unless novalidate is specified. I guess we would need to experiment with multiple validation functions on one element, as AFAIK the HTML5 spec only allows for one error message at a time. Would also allow for styling of inputs in a more standardized manner via the :invalid and :valid psuedo classes. |
|
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes angular#4293 Closes angular#2144 Closes angular#4857 Closes angular#5120 Closes angular#4945 Closes angular#5500
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes angular#4293 Closes angular#2144 Closes angular#4857 Closes angular#5120 Closes angular#4945 Closes angular#5500
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes angular#4293 Closes angular#2144 Closes angular#4857 Closes angular#5120 Closes angular#4945 Closes angular#5500
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes angular#4293 Closes angular#2144 Closes angular#4857 Closes angular#5120 Closes angular#4945 Closes angular#5500
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes angular#4293 Closes angular#2144 Closes angular#4857 Closes angular#5120 Closes angular#4945 Closes angular#5500
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes angular#4293 Closes angular#2144 Closes angular#4857 Closes angular#5120 Closes angular#4945 Closes angular#5500
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes angular#4293 Closes angular#2144 Closes angular#4857 Closes angular#5120 Closes angular#4945 Closes angular#5500
Just an idea, not an issue. Perhaps the $setValidity method in the input directive could call the HTML5 constraint validation api?
Some validation attributes are the same as the standard html5 attributes and will cause native browser validation, however others will not. Perhaps we could force the input directive to be more html5 compatible by integrating better with the element.validity.* properties?
The text was updated successfully, but these errors were encountered: