Email with commas in TextArea Validation (MVC3)
I have a textarea where user can put emails with comma as a separator. Is there a开发者_运维知识库ny way to walidate this so I can return error message in case he puts email in a wrong way?
Personally, I would use a regex to extract all valid emails and ignore everything else. If there are no valid emails, then present a message to the user.
I would create a custom validator for your case. That way, you can parse the list by comma and check each one individually (do a search for custom validator in mvc 3 and you should find plenty of examples)
精彩评论