[jQuery] Re: Firefox problems ( with input reg. exp. verification).

2008-11-20 Thread Jsbeginner


Your code is alot better than mine and the use of test instead of match is
better too. However I still have the same problem, even with your code with
Firefox after 16 characters even typed slowley, Firefox becomes slow and
after 20-25 characters it even blocks... Is this a bug with firefox or with
my code ? How can I fix this problem ?

Is it my RegExp ? I can't see how it could be the code as yours is very
simple

Rik Lomas wrote:
 
 
 I've simplified your code for you and sped up your testing by using
 the regular expression test() method
 
 $(document).ready(function(){
   $('input#domain').keyup(function(){
 var domain = $(this).val();
 var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
 if (reg.test(domain)) {
   $(#ok).html(Correct format ...);
 } else {
   $(#ok).html(Wrong format .../p);
}
   });
 });
 
 
 
 2008/11/19 Jsbeginner [EMAIL PROTECTED]:


 Hello, this is my first topic here, so I hope that I'm doing the right.
 I've
 done a search on google and on this forum without finding anyone with the
 same problem as me, but maybe I'm not looking for the right keywords.

 Here is my problem : I've created a very simple script that checks if a
 domain is in a valid format or not, however with Firefox 3 it does not
 like
 domains that are more than 20 characters long and firefox slows down and
 then completly blocks.

 Here is my code :

 test.js :
 function domchk() {
   var domain = $(input#domain).val();
   var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
   if (domain.match(reg)) {
  $(#ok).html(Correct format ...);
   } else {
  $(#ok).html(Wrong format .../p);
   }
 }

 function simple_chk(target_items){
  $(target_items).each(function(){
  $(this).keyup(function(){
 domchk();
  });
 });
 }


 $(document).ready(function(){
   simple_chk(input);
 });


 test.html :
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
 titleTest page/title
 script type=text/javascript src=jquery-1.2.6.min.js/script
 script type=text/javascript src=test.js/script
 /head

 body
 h1 Javascript domain check .../h1
 form
 p
 input id=domain type=text //p
 p id=okNot changed yet.../p
 /form
 /body
 /html

 --
 View this message in context:
 http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20580852.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.


 
 
 
 -- 
 Rik Lomas
 http://rikrikrik.com
 
 

-- 
View this message in context: 
http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20598552.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Firefox problems ( with input reg. exp. verification).

2008-11-20 Thread Rik Lomas

Hey, the problem seems to be with the {2,63} bit, so I've rewritten
your code (again), it's not as strict as before but it's a lot faster
now because it tests string length rather than regex lengths:

$(document).ready(function(){
  var reg = /^[a-z0-9]+[a-z0-9\-\.]*\.[a-z]{2,4}$/i;
  $('input#domain').keyup(function(){
var domain = $(this).val();
if (reg.test(domain)  domain.length = 5  domain.length = 68) {
  $(#ok).html(Correct format...);
} else {
  $(#ok).html(Wrong format...);
}
  });
});

Rik


2008/11/20 Jsbeginner [EMAIL PROTECTED]:


 Your code is alot better than mine and the use of test instead of match is
 better too. However I still have the same problem, even with your code with
 Firefox after 16 characters even typed slowley, Firefox becomes slow and
 after 20-25 characters it even blocks... Is this a bug with firefox or with
 my code ? How can I fix this problem ?

 Is it my RegExp ? I can't see how it could be the code as yours is very
 simple

 Rik Lomas wrote:


 I've simplified your code for you and sped up your testing by using
 the regular expression test() method

 $(document).ready(function(){
   $('input#domain').keyup(function(){
 var domain = $(this).val();
 var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
 if (reg.test(domain)) {
   $(#ok).html(Correct format ...);
 } else {
   $(#ok).html(Wrong format .../p);
}
   });
 });



 2008/11/19 Jsbeginner [EMAIL PROTECTED]:


 Hello, this is my first topic here, so I hope that I'm doing the right.
 I've
 done a search on google and on this forum without finding anyone with the
 same problem as me, but maybe I'm not looking for the right keywords.

 Here is my problem : I've created a very simple script that checks if a
 domain is in a valid format or not, however with Firefox 3 it does not
 like
 domains that are more than 20 characters long and firefox slows down and
 then completly blocks.

 Here is my code :

 test.js :
 function domchk() {
   var domain = $(input#domain).val();
   var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
   if (domain.match(reg)) {
  $(#ok).html(Correct format ...);
   } else {
  $(#ok).html(Wrong format .../p);
   }
 }

 function simple_chk(target_items){
  $(target_items).each(function(){
  $(this).keyup(function(){
 domchk();
  });
 });
 }


 $(document).ready(function(){
   simple_chk(input);
 });


 test.html :
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
 titleTest page/title
 script type=text/javascript src=jquery-1.2.6.min.js/script
 script type=text/javascript src=test.js/script
 /head

 body
 h1 Javascript domain check .../h1
 form
 p
 input id=domain type=text //p
 p id=okNot changed yet.../p
 /form
 /body
 /html

 --
 View this message in context:
 http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20580852.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.





 --
 Rik Lomas
 http://rikrikrik.com



 --
 View this message in context: 
 http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20598552.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.





-- 
Rik Lomas
http://rikrikrik.com


[jQuery] Re: Firefox problems ( with input reg. exp. verification).

2008-11-20 Thread Jsbeginner


The length check = 5 does not do anything rearly as with a .com you 
already have 4 characters so it allows b.com which is not possible. But 
if you change the 5 to 6 it stops two letter domains for two letter 
extensions. As for the 62 maximum size I've solved this problem with 
html setting the maximum number of characters allowed.


So I've used your code without the length checkup and have used PHP's 
Regular expressions check to catch any domains with only one character 
before the extension.


I guess the only solution would be to use javascript to split the domain 
into hostname and extension and then to check the individually... but 
this would be a pain.


I find it strange that Firefox can not seem to handle such a simple Reg 
Exp ... :(


Rik Lomas wrote:

Hey, the problem seems to be with the {2,63} bit, so I've rewritten
your code (again), it's not as strict as before but it's a lot faster
now because it tests string length rather than regex lengths:

$(document).ready(function(){
  var reg = /^[a-z0-9]+[a-z0-9\-\.]*\.[a-z]{2,4}$/i;
  $('input#domain').keyup(function(){
var domain = $(this).val();
if (reg.test(domain)  domain.length = 5  domain.length = 68) {
  $(#ok).html(Correct format...);
} else {
  $(#ok).html(Wrong format...);
}
  });
});

Rik


2008/11/20 Jsbeginner [EMAIL PROTECTED]:
  

Your code is alot better than mine and the use of test instead of match is
better too. However I still have the same problem, even with your code with
Firefox after 16 characters even typed slowley, Firefox becomes slow and
after 20-25 characters it even blocks... Is this a bug with firefox or with
my code ? How can I fix this problem ?

Is it my RegExp ? I can't see how it could be the code as yours is very
simple

Rik Lomas wrote:


I've simplified your code for you and sped up your testing by using
the regular expression test() method

$(document).ready(function(){
  $('input#domain').keyup(function(){
var domain = $(this).val();
var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
if (reg.test(domain)) {
  $(#ok).html(Correct format ...);
} else {
  $(#ok).html(Wrong format .../p);
   }
  });
});



2008/11/19 Jsbeginner [EMAIL PROTECTED]:
  

Hello, this is my first topic here, so I hope that I'm doing the right.
I've
done a search on google and on this forum without finding anyone with the
same problem as me, but maybe I'm not looking for the right keywords.

Here is my problem : I've created a very simple script that checks if a
domain is in a valid format or not, however with Firefox 3 it does not
like
domains that are more than 20 characters long and firefox slows down and
then completly blocks.

Here is my code :

test.js :
function domchk() {
  var domain = $(input#domain).val();
  var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
  if (domain.match(reg)) {
 $(#ok).html(Correct format ...);
  } else {
 $(#ok).html(Wrong format .../p);
  }
}

function simple_chk(target_items){
 $(target_items).each(function(){
 $(this).keyup(function(){
domchk();
 });
});
}


$(document).ready(function(){
  simple_chk(input);
});


test.html :
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
titleTest page/title
script type=text/javascript src=jquery-1.2.6.min.js/script
script type=text/javascript src=test.js/script
/head

body
h1 Javascript domain check .../h1
form
p
input id=domain type=text //p
p id=okNot changed yet.../p
/form
/body
/html

--
View this message in context:
http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20580852.html
Sent from the jQuery General Discussion mailing list archive at
Nabble.com.





--
Rik Lomas
http://rikrikrik.com


  

--
View this message in context: 
http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20598552.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.







  





[jQuery] Re: Firefox problems ( with input reg. exp. verification).

2008-11-19 Thread Rik Lomas

I've simplified your code for you and sped up your testing by using
the regular expression test() method

$(document).ready(function(){
  $('input#domain').keyup(function(){
var domain = $(this).val();
var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
if (reg.test(domain)) {
  $(#ok).html(Correct format ...);
} else {
  $(#ok).html(Wrong format .../p);
   }
  });
});



2008/11/19 Jsbeginner [EMAIL PROTECTED]:


 Hello, this is my first topic here, so I hope that I'm doing the right. I've
 done a search on google and on this forum without finding anyone with the
 same problem as me, but maybe I'm not looking for the right keywords.

 Here is my problem : I've created a very simple script that checks if a
 domain is in a valid format or not, however with Firefox 3 it does not like
 domains that are more than 20 characters long and firefox slows down and
 then completly blocks.

 Here is my code :

 test.js :
 function domchk() {
   var domain = $(input#domain).val();
   var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ;
   if (domain.match(reg)) {
  $(#ok).html(Correct format ...);
   } else {
  $(#ok).html(Wrong format .../p);
   }
 }

 function simple_chk(target_items){
  $(target_items).each(function(){
  $(this).keyup(function(){
 domchk();
  });
 });
 }


 $(document).ready(function(){
   simple_chk(input);
 });


 test.html :
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
 titleTest page/title
 script type=text/javascript src=jquery-1.2.6.min.js/script
 script type=text/javascript src=test.js/script
 /head

 body
 h1 Javascript domain check .../h1
 form
 p
 input id=domain type=text //p
 p id=okNot changed yet.../p
 /form
 /body
 /html

 As you can see I've reduced the code to the bare minimum to make sure that
 it was not another part of the code causing the problem, and also so that
 you can maybe see the problem without having to read through lots of code.
 This simplified version does exactly the same thing as the main one so the
 problem is in the few lines of javascript. I've not includes the latest
 stable version of jquery as I guess that you already have it...

 Thanks in advance :).
 --
 View this message in context: 
 http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20580852.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.





-- 
Rik Lomas
http://rikrikrik.com