Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

typeahead-editable, typeahead-min-length and required validation are not syncing with each other #5694

Closed
sv311 opened this issue Mar 25, 2016 · 0 comments

Comments

@sv311
Copy link

sv311 commented Mar 25, 2016

The issues forum is NOT for support requests. It is for bugs and feature requests only.
Please read https://github.com/angular-ui/bootstrap/blob/master/CONTRIBUTING.md and search
existing issues (both open and closed) prior to opening any new issue and ensure you follow the instructions therein.

Bug description:

Setting the option typeahead-editable="false", typeahead-min-length="3" and required on an input text does not trigger the required error validation. It's hard to explain but I have created a plunker to demonstrate it. Please see link below.

  1. When first loaded, enter "ben" for the input and tab out or click outside of input. All is fine. error object shows nothing.
  2. Click on input and erase "ben". All is fine, error shows {"required":true} as expected.
  3. Enter "be" and tab out. The field is clear. Here, the error object is blank and the field is valid. This shouldn't be the case. The field is blank therefore it should be in the invalid state. This won't work for me since I need to display the error message.
  4. Enter "be" again and tab out. The field is clear again. But now, the error object shows {"editable":true,"parse":true} and invalid is true. The problem here is the error messages is based upon the required validation. As you can see here, error object doesn't have {"required" : true} therefore the error message doesn't show up. However, invalid is set to true. I suppose one could just use myForm.myName.$invalid and display the error message. This though won't work for me since I have more than one validation on the input field. The field been invalid doesn't tell me the right error to display. For simplicity, I only put one validation for demonstration only.

Step 3 and 4 are both issues I need to resolve. Greatly appreciated if someone can help me out here.

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/xQ6OoSd18xB1U4V7XUEy

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.2

UIBS: 1.2.5

Bootstrap: 3.3.6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants