Commit 09f8f007 authored by Peter Droogmans's avatar Peter Droogmans
Browse files

Issue #1525360 by smilne23: Added Exclude specific fields based upon their DOM ID.

parent 02b6cec3
......@@ -25,7 +25,14 @@ function clientside_validation_form_after_build_recurse($form_id, &$form, &$form
function clientside_validation_regular($form_id, $element, &$js_rules, $form_state) {
static $multiples = array();
if (isset($element['#name'])) {
$skipvalidation = FALSE;
if (isset($element['#entity_type']) && isset($element['#field_name']) && isset($element['#bundle'])) {
$field_info = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
if (isset($field_info['exclude_cv']) && $field_info['exclude_cv'] == '1') {
$skipvalidation = TRUE;
}
}
if (isset($element['#name']) && !$skipvalidation) {
$el_name = $element['#name'];
$el_title = $el_name;
if (isset($element['#title'])) {
......@@ -137,3 +144,23 @@ function clientside_validation_regular($form_id, $element, &$js_rules, $form_sta
}
}
}
function clientside_validation_form_field_info_alter(&$info) {
// Add a setting to all field types.
foreach ($info as $field_type => &$field_type_info) {
$field_type_info += array('instance_settings' => array());
$field_type_info['instance_settings'] += array(
'exclude_cv' => FALSE,
);
}
}
function clientside_validation_form_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
$form['instance']['exclude_cv'] = array(
'#type' => 'checkbox',
'#title' => 'Exclude from clientside validation',
'#description' => 'Check this option if you do not want to add clientside validation.',
'#default_value' => isset($form['#instance']['exclude_cv']) ? $form['#instance']['exclude_cv'] : FALSE,
'#weight' => -9,
);
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment