bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

The datepicker's `date-disabled` validation error does not conform to angular validation error standards, and requires awkward syntax to react to on the front-end.

Open Asvarduil opened this issue 11 years ago • 9 comments

Reproduction Plunker can be found here

Steps to Reproduce:

Open the reproduction plunker given above.

Observe that the testText control has a min-date of 1/2/2000 and max-date attribute of 12/31/2099.

Enter a value outside of the min/max date range (e.g. 1/1/1900 or 1/1/2100)

Observe that both the form-level and control-level validation messages use the syntax, testform.$error['date-disabled'] and testForm.testText.$error['date-disabled']

In the "Form Error Dictionary Blob" section, observe that the JSON blob has date-disabled as the key.

Observed Behavior:

It's necessary to use testform.$error['date-disabled'] or testForm.testText.$error['date-disabled'] to access the error object for a date being outside of the min/max-date range.

Expected Behavior:

I should be able to use the fluent syntax, testForm.$error.dateDisabled or testForm.testText.$error.dateDisabled when interacting with the dateDisabled validation error on the front end.

Asvarduil avatar Mar 25 '15 16:03 Asvarduil

What is the reason for setting disabled control to invalid? I would like to see it fixed.

cmichal avatar Apr 24 '15 07:04 cmichal

Also observed this error. It messes with my form validation.

Duskfall avatar Jul 02 '15 11:07 Duskfall

This seems like a bug. The control adds date-disabled property under the forms $error object, but the actual control itself shows valid: true!

aarosil avatar Jul 28 '15 22:07 aarosil

@Asvarduil @wesleycho @BobbieBarker This issue should be fixed with PR #3606. There hasn't been any activity on it in over a month though so I'm not sure when they plan on pulling it in. PRs #3440 and #3438 are related to this.

willisd2 avatar Jul 30 '15 15:07 willisd2

It appears this is already fixed - the validation key is now dateDisabled in master (may have been there for the past couple of releases.

wesleycho avatar Oct 31 '15 18:10 wesleycho

@wesleycho It appears that the validation key is in there correctly now, however it still doesn't have the expected behavior. In the plunker above, if you change it to use the latest angular.js (1.4.7) and latest ui-bootstrap (14.3) you still can't get the validation message to pop up if you manually type in a date outside of the range. The only time I can see the dateDisabled error show up in the $errors array is if you have an invalid date typed in, then open up the datepicker popup.

willisd2 avatar Nov 02 '15 15:11 willisd2

@willisd2 I've found that if you've opened the datepicker once, it'll show up, so open it, close it, and the validator seems attached. I find it weird that the validation error is not on the field itself, only on the form $error array...

icorne avatar Jul 26 '16 12:07 icorne

@willisd2 Yeah I'm having that problem now. The form is loading up with an illegal value but isn't mark as valid until I pop open the datepicker popup. Is there a way to auto digest the validation?

IngoVals avatar Dec 13 '17 13:12 IngoVals

Why is this closed? The issue doesn't seem to be resolved.

ataravati avatar Mar 02 '18 03:03 ataravati