开发者

Email with commas in TextArea Validation (MVC3)

开发者 https://www.devze.com 2023-03-17 04:44 出处:网络
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 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)

0

精彩评论

暂无评论...
验证码 换一张
取 消