FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=16906&edit=1

ID: 16906
Updated by: [email protected]
Reported By: hm2k at php dot net
Summary: no email validation like HTML_Qu
Status: Open
Type: Feature/Change Request
Package: HTML_QuickForm2
Package Version: 0.3.0
PHP Version: Irrelevant
Roadmap Versions:
New Comment:

One could easily use PHP's filter method to check if a string is a valid
email:
function isValidEmail($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
That would need to be combined with a callback.

But yes, it'd be cool if that rule would exist in HTML_QuickForm2 by
default since it's a common usecase.


Previous Comments:
------------------------------------------------------------------------

[2009-12-15 11:27:23] hm2k

Description:
------------
HTML_QuickForm had email validation HTML_QuickForm2 does not, any
reason?

------------------------------------------------------------------------

Search Discussions

  • Hm2k at Jul 9, 2010 at 9:18 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16906&edit=1

    ID: 16906
    Updated by: [email protected]
    Reported By: hm2k at php dot net
    Summary: no email validation like HTML_Qu
    Status: Open
    Type: Feature/Change Request
    Package: HTML_QuickForm2
    Package Version: 0.3.0
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    It would make sense, especially as previously PHP used to base it's
    FILTER_VALIDATE_EMAIL on HTML_QuickForm's regex.

    Where once HTML_QuickForm was leading the way, HTML_QuickForm2 has not
    filled that gap.

    Let's see it return.


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-07-09 09:50:24] cweiske

    One could easily use PHP's filter method to check if a string is a valid
    email:
    function isValidEmail($email) {
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    }
    That would need to be combined with a callback.

    But yes, it'd be cool if that rule would exist in HTML_QuickForm2 by
    default since it's a common usecase.

    ------------------------------------------------------------------------

    [2009-12-15 11:27:23] hm2k

    Description:
    ------------
    HTML_QuickForm had email validation HTML_QuickForm2 does not, any
    reason?

    ------------------------------------------------------------------------
  • Php at Jul 9, 2010 at 9:38 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16906&edit=1

    ID: 16906
    Updated by: [email protected]
    Reported By: hm2k at php dot net
    Summary: no email validation like HTML_Qu
    Status: Open
    Type: Feature/Change Request
    Package: HTML_QuickForm2
    Package Version: 0.3.0
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    We could also add a new rule simply called 'filter_var' or 'filter' that
    would in turn
    call the function filter_var() with given parameters ? It would make
    things easier
    than using the callback rule. The filter extension is apparently enabled
    by default
    since PHP 5.2, which is our minimum version for using QF2 so it should
    be ok.

    The filter_var email regex is a bit difficult to read and will validate
    addresses with
    IPv4 or IPv6 in place of domain names which might not always be what you
    expect.

    At the moment, I use this regex instead :
    "/^[_+a-z0-9-]+(\.[_+a-z0-9-']+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a-
    z]{2,}){1}$/"

    It's not perfect but it fits my needs.


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-07-09 10:10:45] hm2k

    It would make sense, especially as previously PHP used to base it's
    FILTER_VALIDATE_EMAIL on HTML_QuickForm's regex.

    Where once HTML_QuickForm was leading the way, HTML_QuickForm2 has not
    filled that gap.

    Let's see it return.

    ------------------------------------------------------------------------

    [2010-07-09 09:50:24] cweiske

    One could easily use PHP's filter method to check if a string is a valid
    email:
    function isValidEmail($email) {
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    }
    That would need to be combined with a callback.

    But yes, it'd be cool if that rule would exist in HTML_QuickForm2 by
    default since it's a common usecase.

    ------------------------------------------------------------------------

    [2009-12-15 11:27:23] hm2k

    Description:
    ------------
    HTML_QuickForm had email validation HTML_QuickForm2 does not, any
    reason?

    ------------------------------------------------------------------------
  • Hm2k at Jul 9, 2010 at 10:10 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16906&edit=1

    ID: 16906
    Updated by: [email protected]
    Reported By: hm2k at php dot net
    Summary: no email validation like HTML_Qu
    Status: Open
    Type: Feature/Change Request
    Package: HTML_QuickForm2
    Package Version: 0.3.0
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    I wrote a whole essay on this matter:

    http://www.hm2k.com/posts/what-is-a-valid-email-address

    It pretty much addresses my concerns here.


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-07-09 10:30:17] mansion

    We could also add a new rule simply called 'filter_var' or 'filter' that
    would in turn
    call the function filter_var() with given parameters ? It would make
    things easier
    than using the callback rule. The filter extension is apparently enabled
    by default
    since PHP 5.2, which is our minimum version for using QF2 so it should
    be ok.

    The filter_var email regex is a bit difficult to read and will validate
    addresses with
    IPv4 or IPv6 in place of domain names which might not always be what you
    expect.

    At the moment, I use this regex instead :
    "/^[_+a-z0-9-]+(\.[_+a-z0-9-']+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a-
    z]{2,}){1}$/"

    It's not perfect but it fits my needs.

    ------------------------------------------------------------------------

    [2010-07-09 10:10:45] hm2k

    It would make sense, especially as previously PHP used to base it's
    FILTER_VALIDATE_EMAIL on HTML_QuickForm's regex.

    Where once HTML_QuickForm was leading the way, HTML_QuickForm2 has not
    filled that gap.

    Let's see it return.

    ------------------------------------------------------------------------

    [2010-07-09 09:50:24] cweiske

    One could easily use PHP's filter method to check if a string is a valid
    email:
    function isValidEmail($email) {
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    }
    That would need to be combined with a callback.

    But yes, it'd be cool if that rule would exist in HTML_QuickForm2 by
    default since it's a common usecase.

    ------------------------------------------------------------------------

    [2009-12-15 11:27:23] hm2k

    Description:
    ------------
    HTML_QuickForm had email validation HTML_QuickForm2 does not, any
    reason?

    ------------------------------------------------------------------------
  • Cweiske at Jul 9, 2010 at 2:16 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16906&edit=1

    ID: 16906
    Updated by: [email protected]
    Reported By: hm2k at php dot net
    Summary: no email validation like HTML_Qu
    Status: Open
    Type: Feature/Change Request
    Package: HTML_QuickForm2
    Package Version: 0.3.0
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    While the filter_var rule is a good idea itself, is it not something I
    would advise people to use for validating email addresses with QF2 -
    it's a common task that requires an own rule IMO.


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-07-09 11:02:27] hm2k

    I wrote a whole essay on this matter:

    http://www.hm2k.com/posts/what-is-a-valid-email-address

    It pretty much addresses my concerns here.

    ------------------------------------------------------------------------

    [2010-07-09 10:30:17] mansion

    We could also add a new rule simply called 'filter_var' or 'filter' that
    would in turn
    call the function filter_var() with given parameters ? It would make
    things easier
    than using the callback rule. The filter extension is apparently enabled
    by default
    since PHP 5.2, which is our minimum version for using QF2 so it should
    be ok.

    The filter_var email regex is a bit difficult to read and will validate
    addresses with
    IPv4 or IPv6 in place of domain names which might not always be what you
    expect.

    At the moment, I use this regex instead :
    "/^[_+a-z0-9-]+(\.[_+a-z0-9-']+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a-
    z]{2,}){1}$/"

    It's not perfect but it fits my needs.

    ------------------------------------------------------------------------

    [2010-07-09 10:10:45] hm2k

    It would make sense, especially as previously PHP used to base it's
    FILTER_VALIDATE_EMAIL on HTML_QuickForm's regex.

    Where once HTML_QuickForm was leading the way, HTML_QuickForm2 has not
    filled that gap.

    Let's see it return.

    ------------------------------------------------------------------------

    [2010-07-09 09:50:24] cweiske

    One could easily use PHP's filter method to check if a string is a valid
    email:
    function isValidEmail($email) {
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    }
    That would need to be combined with a callback.

    But yes, it'd be cool if that rule would exist in HTML_QuickForm2 by
    default since it's a common usecase.

    ------------------------------------------------------------------------

    [2009-12-15 11:27:23] hm2k

    Description:
    ------------
    HTML_QuickForm had email validation HTML_QuickForm2 does not, any
    reason?

    ------------------------------------------------------------------------
  • Hm2k at Jul 9, 2010 at 3:53 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16906&edit=1

    ID: 16906
    Updated by: [email protected]
    Reported By: hm2k at php dot net
    Summary: no email validation like HTML_Qu
    Status: Open
    Type: Feature/Change Request
    Package: HTML_QuickForm2
    Package Version: 0.3.0
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    My advise would be to impliment it from HTML_QuickForm and improve.

    Implementing filter_var, while better than nothing isn't exactly ideal.


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-07-09 15:08:37] cweiske

    While the filter_var rule is a good idea itself, is it not something I
    would advise people to use for validating email addresses with QF2 -
    it's a common task that requires an own rule IMO.

    ------------------------------------------------------------------------

    [2010-07-09 11:02:27] hm2k

    I wrote a whole essay on this matter:

    http://www.hm2k.com/posts/what-is-a-valid-email-address

    It pretty much addresses my concerns here.

    ------------------------------------------------------------------------

    [2010-07-09 10:30:17] mansion

    We could also add a new rule simply called 'filter_var' or 'filter' that
    would in turn
    call the function filter_var() with given parameters ? It would make
    things easier
    than using the callback rule. The filter extension is apparently enabled
    by default
    since PHP 5.2, which is our minimum version for using QF2 so it should
    be ok.

    The filter_var email regex is a bit difficult to read and will validate
    addresses with
    IPv4 or IPv6 in place of domain names which might not always be what you
    expect.

    At the moment, I use this regex instead :
    "/^[_+a-z0-9-]+(\.[_+a-z0-9-']+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a-
    z]{2,}){1}$/"

    It's not perfect but it fits my needs.

    ------------------------------------------------------------------------

    [2010-07-09 10:10:45] hm2k

    It would make sense, especially as previously PHP used to base it's
    FILTER_VALIDATE_EMAIL on HTML_QuickForm's regex.

    Where once HTML_QuickForm was leading the way, HTML_QuickForm2 has not
    filled that gap.

    Let's see it return.

    ------------------------------------------------------------------------

    [2010-07-09 09:50:24] cweiske

    One could easily use PHP's filter method to check if a string is a valid
    email:
    function isValidEmail($email) {
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    }
    That would need to be combined with a callback.

    But yes, it'd be cool if that rule would exist in HTML_QuickForm2 by
    default since it's a common usecase.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=16906

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJul 9, '10 at 8:58a
activeJul 9, '10 at 3:53p
posts6
users3
websitepear.php.net

3 users in discussion

Hm2k: 3 posts Cweiske: 2 posts Php: 1 post

People

Translate

site design / logo © 2023 Grokbase