View Single Post
  #11  
Old 08-18-2008, 08:15 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Validation script to check if custom text field has been filled

Quote:
Originally Posted by Warwick
Well if it is a valuable url i.e. something.something.tld
So something like "domain.tld" or "domain.domain.tld/smth.php" is considering to be an invalid URL and no matter if 'http://' is present?
Try something like this:

Code:
var value = product_option_value("url"); if (value == false ) { alert("Sorry, you should enter an url"); return false; } var re = new RegExp(/^(http:\/\/)?[^\.]+\.[^\.]+\.[^\.]+$/i); if (! re.test(value)) { alert("Url you provided seems to be incorrect"); return false; }
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote