-
25 Sep 2008 9:15 AM #1
[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/
-
25 Sep 2008 9:23 AM #2
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.
-
26 Sep 2008 4:31 AM #3
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.
-
26 Sep 2008 7:17 AM #4
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.
-
29 Sep 2008 9:31 AM #5
Confirmed
Confirmed
I'm also experiencing the same bug in Safari. It works fine in other browsers and also with shorter emails.
-
29 Oct 2008 12:33 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
The email regexp has two characters that should have been escaped.
The correct regexp is:
ps. This also fixes this bug.Code:Ext.form.VTypes.email = function(v){ return /^([\w]+)(\.[\w]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/.test(v); }
-
29 Oct 2008 1:05 AM #7
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
29 Oct 2008 1:31 AM #8Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
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 "[]")
-
29 Oct 2008 1:40 AM #9
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
4 Dec 2008 8:48 AM #10
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.


Reply With Quote
