Form validation, required fields, email fields, etc.

894 views
Skip to first unread message

Calvin Froedge

unread,
Jan 3, 2013, 3:13:43 PM1/3/13
to ang...@googlegroups.com
Hi,

Loving Angular so far!  One question - with the built in directives (email, required, etc.), if I submit the form then the browser jumps to the field and says "Please fill out this field."

How do I cause my own directives (ie matches, password, isOneOfThese, etc.) have similar behavior?  Here is an example directive: http://pastebin.com/kueDPDbb

Also, if I want to customize the text for the other directives, how would I do that?

Thanks in advance!
- Calvin

Pawel Kozlowski

unread,
Jan 3, 2013, 3:16:59 PM1/3/13
to ang...@googlegroups.com
Hi!

Not sure but I think you are seeing browser's trick (HTML5) and not
the AngularJS one.
If you could send a live code example (jsFiddle / plunker) would be
easier to say.

BTW: you can read up on form validations with AngularJS here:
http://docs.angularjs.org/guide/forms

Cheers,
Pawel
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular?hl=en-US.
>
>



--
Question? Send a fiddle
(http://jsfiddle.net/pkozlowski_opensource/Q2NpJ/) or a plunk
(http://plnkr.co/)
Need help with jsFiddle? Check this:
http://pkozlowskios.wordpress.com/2012/08/12/using-jsfiddle-with-angularjs/

Looking for UI widget library for AngularJS? Here you go:
http://angular-ui.github.com/
Reply all
Reply to author
Forward
0 new messages