1. #1
    Ext User
    Join Date
    Sep 2008
    Posts
    6
    Vote Rating
    0
    ryanpetrello is on a distinguished road

      0  

    Default [2.2] "Email" VType Incorrect in Safari

    [2.2] "Email" VType Incorrect in Safari


    I'm running Ext 2.2 (just downloaded the latest source for my example), Safari Version 3.1.2 (5525.20.1) on Mac OSX 10.5 (Leopard) and came across an odd issue.

    I'm using the 'email' Ext.form.VType for validation in a FormPanel and am noticing odd behavior that only occurs in Safari. For some reason, the validator flags otherwise valid email input as invalid when supplied with a string which has past a certain character length threshold. From my testing, this threshold appears to be at or around 36 characters, though I've found other instances where it slightly lower or higher.

    I *was* able to reproduce this issue in the latest Webkit nightly, but did *not* find the same behavior in either Firefox 2.5 or Firefox 3.0.2. I've not tested it in any builds of Internet Explorer.

    Because of file upload size limitations, I've linked to a self-contained .zip file, which includes an .html example and the latest complete Ext 2.2 source, to be opened in the Safari browser to illustrate the issue more clearly. This file is quite large in size, over 6MB, so I've also provided a live web link.

    Perhaps this is not a bug, and I'm just overlooking something. Whatever the case, any insight or help is much appreciated!

    The complete package, illustrating the bug, can be found at:
    http://ryanpetrello.com/stuff/ext-bu...ri-ext-bug.zip

    Additionally, a live example can be viewed online at:
    http://ryanpetrello.com/stuff/ext-bug/

  2. #2
    Ext User
    Join Date
    Sep 2008
    Posts
    6
    Vote Rating
    0
    ryanpetrello is on a distinguished road

      0  

    Default Interesting Note

    Interesting Note


    On further investigation, the real problem appears to be the lengthening of the domain name. I've noticed that as the domain name passes a threshold of 18 characters, it becomes invalid (the total length of the string appears to actually be inconsequential). For example:

    ryan@someWebsiteYouLove.com
    (domain character length, 18)

    ...passes validation, while:

    ryanPetrello@someWebsiteYouLove.com
    (domain character length, 18)

    ...continues to pass, but ultimately:

    ryan@someWebsiteYouLoves.com
    ryanPetrello@someWebsiteYouLoves.com
    (domain character length, 19)

    ...both fail validation.

  3. #3
    Ext User
    Join Date
    Sep 2008
    Posts
    6
    Vote Rating
    0
    ryanpetrello is on a distinguished road

      0  

    Default


    Any developers able to reproduce this? Any insight or comments? I'm working on this in reply to a reported bug in our live application, so if anyone can offer even a temporary solution, I'd much appreciate it.

  4. #4
    Ext User
    Join Date
    Sep 2008
    Posts
    6
    Vote Rating
    0
    ryanpetrello is on a distinguished road

      0  

    Default


    Upon further investigation, it almost seems that this is an error in Safari's regular expression engine. For experimentation purposes, I've taken the e-mail regular expression that Ext uses and tested it against strings with domain namelengths greater than 18 characters. Running the following in Safari:

    /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/.test('me@ryanpetrello123456.com');

    ...returns true, while:

    /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/.test('me@ryanpetrello1234567.com');

    ...returns false. This shouldn't be the case, as the regular expression should be a match for the provided string. With the help of Firebug, I found that even Firefox 2.5 agrees.

    Interesting...

    I'm reporting this as a bug to the WebKit team. Perhaps in the meantime, if may be wise for Ext to adopt a different email regular expression that also works in Safari? I realize this isn't a problem w/ Ext's codebase, but at the same time, it may be awhile before a fix for this is pushed out, leaving Safari users with broken validation for some time to come.

  5. #5
    Ext JS Premium Member
    Join Date
    Nov 2007
    Location
    San Francisco
    Posts
    10
    Vote Rating
    0
    wheelhouse is on a distinguished road

      0  

    Default Confirmed

    Confirmed


    I'm also experiencing the same bug in Safari. It works fine in other browsers and also with shorter emails.

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    92
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    The email regexp has two characters that should have been escaped.

    The correct regexp is:
    Code:
    Ext.form.VTypes.email = function(v){
    	return /^([\w]+)(\.[\w]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/.test(v);
    }
    ps. This also fixes this bug.

  7. #7
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    Quote Originally Posted by Condor View Post
    The email regexp has two characters that should have been escaped.

    The correct regexp is:
    Code:
    Ext.form.VTypes.email = function(v){
    	return /^([\w]+)(\.[\w]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/.test(v);
    }
    ps. This also fixes this bug.
    just curious, but since the "-" is inside a character class, (i.e. [\w\-]), and it does not belong to indicate a range, does it still need to be escaped?

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    92
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    The unescaped "." was causing the trouble and the "-" worked, but just to be on the safe side the "-" should be escaped because it does have special meaning within "[]".

    (the url vtype also escapes the "-" within "[]")

  9. #9
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    Quote Originally Posted by Condor View Post
    The unescaped "." was causing the trouble and the "-" worked, but just to be on the safe side the "-" should be escaped because it does have special meaning within "[]".

    (the url vtype also escapes the "-" within "[]")
    got it. thanks

  10. #10
    Ext User
    Join Date
    Sep 2008
    Posts
    5
    Vote Rating
    0
    leoman730 is on a distinguished road

      0  

    Default Another issue with emaill vtype

    Another issue with emaill vtype


    There's another issue with the "email" vtype validation on Safari 3.0.4 installed on Leopard.
    I am using ext 2.2.
    The problem is when a textfield is implement with vtype, I cann't use backspace for that field. Seems to me this ONLY happen on Safari 3.0.4. All other browser are working fine.
    Any help would very appreciated.

    Thanks.