Form validation with name containing '-' character

460 views
Skip to first unread message

Corinne Krych

unread,
Mar 1, 2013, 4:56:44 PM3/1/13
to ang...@googlegroups.com
Hello

When my form name is friend-u validation doesn't apply. Changing it to friend is ok. However I need dash in my form name. Is it a know issue?
I couldn't find it...
http://jsfiddle.net/corinnekrych/mMQvj/

++
Corinne

Dave Merrill

unread,
Mar 2, 2013, 6:47:51 AM3/2/13
to ang...@googlegroups.com
Here's an example comparing forms with and without a hyphen in their name: http://jsfiddle.net/davemerrill/nEPLL/2/

Far as I can tell, the visual highlighting works either way, but I don't know how to access the form in code with a hyphen in the name. It may not actually be possible, because the form name isn't a valid js variable name. There may be some bracket notation way to access it, but I don't know what it'd be.

What makes you need the hyphen there? The name of a form isn't seen by the server, it isn't even required except for angular validation. Can't think of a functional requirement that would make the hyphen mandatory.

Dave Merrill

Corinne Krych

unread,
Mar 2, 2013, 8:52:56 AM3/2/13
to ang...@googlegroups.com
Thks 
I diddn't understand that actually form name is used as js variable name. Make sense then.
I will not struggle for that details and go the way you suggested with camel case. It's just I find the code nice with snake case in HTML

Thks for your help
COrinne

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dave Merrill

unread,
Mar 2, 2013, 1:10:08 PM3/2/13
to ang...@googlegroups.com
However things are built inside Angular, any expression involving "friend-u" looks to js like "the value of friend minus the value of u". Nothing about that syntax distinguishes between those two meanings.

Dave
Reply all
Reply to author
Forward
0 new messages