You are here

function elements_validate_url in Elements 7

Form element validation handler for #type 'url'.

Note that #maxlength and #required is validated by _form_validate() already.

1 string reference to 'elements_validate_url'
elements_element_info in ./elements.module
Implements hook_element_info().

File

./elements.module, line 257

Code

function elements_validate_url(&$element, &$form_state) {
  if ($element['#value'] && !valid_url($element['#value'], TRUE)) {
    form_error($element, t('The URL %url is not valid.', array(
      '%url' => $element['#value'],
    )));
  }
}