You are here

function _clientside_validation_set_url in Clientside Validation 6

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

Set validation rule for url fields.

1 call to _clientside_validation_set_url()
_clientside_validation_set_fapi_validation in clientside_validation_fapi/clientside_validation_fapi.module
Set fapi validation.

File

./clientside_validation.module, line 976
Add client side validation to a webform.

Code

function _clientside_validation_set_url($name, $title, &$js_rules, $message = '') {
  $title = variable_get('clientside_validation_prefix', '') . $title . variable_get('clientside_validation_suffix', '');
  $js_rules[$name]['url'] = 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);
}