Created
December 10, 2013 22:29
-
-
Save segovia94/7901520 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the required fields that we want to ignore | |
//$safe_fields = array('field_test2'); | |
//just grab all fields in the second field group | |
$safe_fields = $form['#groups']['group_option2']->children; | |
// get a list of all errors | |
$errors = form_get_errors(); | |
// this will clear Error msg queue | |
$messages = drupal_get_messages('error'); | |
// clear all errors so we can add all of them back except the ones we are trying to clear | |
form_clear_error(); | |
if (count($errors)) { | |
foreach ($errors as $field => $msg) { | |
$field_name = substr($field, 0, (strpos($field, '[') - 1)); | |
if (!in_array($field_name, $safe_fields)) form_set_error($field, $msg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment