CCK field element combined validation
This is how you can programmatically create a combined validation.
This is how you can programmatically create a combined validation.
A script with jQuery to validate e-mail address an a form. It changes the class of the form to 'error' and disable the send button if not valid.
A short script for jQuery that validates two password fileds so they have the same value and a minimum length.
This code validates e-mail address with regular expression. This code is from Drupal 6 common.inc.
This is how you can validate an URL by examining the pattern.
<?php
function validateURL($url) {
$pattern = '/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/';
return preg_match($pattern, $url);
}
?>
Or from Drupal 6
/**
* Verify the syntax of the given URL.
*
* This function should only be used on actual URLs.