Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

AngularJS form validation #556

Open
YanBlochSergata opened this issue Dec 29, 2014 · 5 comments
Open

AngularJS form validation #556

YanBlochSergata opened this issue Dec 29, 2014 · 5 comments

Comments

@YanBlochSergata
Copy link

Hey all,

I'm trying to add required to my "ui-select multiple" element, but no success so far.

I tried adding "required" to the input that generates from the directive, but the input doesn't recognize the selections, it keeps being invalid.

@MikeABentley
Copy link

+1

@dannystyleart
Copy link

Hey all!

We've just found that the input that the directive renders has no name attribute, and while this the form validation throws error since can't validate the value of the ui-select.

Did anyone worked out this?
Thanks,

@MikeABentley
Copy link

Can you elaborate on what sort of validation you're trying to accomplish? Sample code as well? thanks.

@dannystyleart
Copy link

@MBentley1976 Yeah, we are using Valdr to validate our forms. we tried to not to make rules / constraints on the model which the ui-select using but since ui-select creates an input inside it ( so inside the form ) valdr tries to fetch it and attach its own validation object(s). It dies since the input has no name attribute.

@MikeABentley
Copy link

I see. Well, I'm not familiar with Valdr but one workaround you may want to try is to create an extension to the ui-select directive. In that extension you can use jquery; either native or the angular wrapped up version, to sniff out the input and add the name attribute yourself. By using an extension you'll get the functionality "for free" everywhere. Good luck.

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

No branches or pull requests

4 participants