开发者

Rails validation prevent email addresses and phone numbers

I am looking for a way in Rails (2.3.9) to PREVENT users from entering email addresses, and phone numbers of as many formats as possible. I have a textbox, and I do not want users to be able to submit email addresses or phone numbers..

Any ideas开发者_Go百科?


Probably the most straightforward method would be to use a custom validation with validate. You can check against the regexes you want to prevent users from submitting and supply your own validation message.

I've created a gist demonstrating this behavior.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜