for validation of email field

10 views
Skip to first unread message

ashok

unread,
Nov 12, 2012, 12:26:00 PM11/12/12
to scooter-...@googlegroups.com
hi friends, how can i validate email_id field
like 
    public void validatesRecord() {
    validators().validatesPresenceOf("email_id");
    validators().validatesLengthMaximum("email_id", 30);
        //Our posts are twitter friendly.
    }

    here we are normally use validators().validatesLengthMaximum("email_id", 30); for limitation of lenght in the field but my question is that if user types invalid email_id in email field then what method i need to write for validation of email field i am using varchar(30) datatype for email_id column in my database

John Chen

unread,
Nov 12, 2012, 5:28:33 PM11/12/12
to scooter-...@googlegroups.com
Use validatesIsEmail("email_id");

This method checks if the email value follows Validators.EMAIL_PATTERN.
Reply all
Reply to author
Forward
0 new messages