You are here

function _clientside_validation_set_url in Clientside Validation 7

Same name and namespace in other branches
  1. 6 clientside_validation.module \_clientside_validation_set_url()

Set validation rule for url fields.

4 calls to _clientside_validation_set_url()
clientside_validation_field_validation_regular in clientside_validation_field_validation/clientside_validation_field_validation.module
clientside_validation_html5 in clientside_validation_html5/clientside_validation_html5.module
clientside_validation_regular in clientside_validation_form/clientside_validation_form.module
_clientside_validation_set_fapi_validation in clientside_validation_fapi/clientside_validation_fapi.module
Set fapi validation.

File

./clientside_validation.module, line 1257
Add client side validation to forms.

Code

function _clientside_validation_set_url($name, $title, &$js_rules, $message = '') {
  $title = _clientside_validation_set_title($title);
  $js_rules[$name]['drupalURL'] = TRUE;
  $variables = array(
    'message' => empty($message) ? 'The value in !title is not a valid url.' : $message,
    'placeholders' => empty($message) ? array(
      '!title' => $title,
    ) : array(),
    'error_type' => 'url',
    'element_name' => $name,
  );
  $js_rules[$name]['messages']['url'] = theme('clientside_error', $variables);
}