I have a weird question. Let's say we have this form:
$form['field1'] = array( '#type' => 'textfield', '#title' => 'First field' ); $form['container'] = array( '#type' => 'container' ); $form['container']['field2'] = array( '#type' => 'textfield', '#title' => 'Second field' );
Now if you set an error for field2, you do it like this:
form_set_error('field2', 'error message');
and not like
form_set_error('container][field2', 'error message');
I wonder how does drupal does recognize the right form element to add the error class. I wanna do something like that, to add a suffix for every field who did not passed validation.
I tried getting the error field with
form_get_errors() but it returns
field2 as a field with an error. It's obvious that
$form['field2'] does not exists add I can't add a suffix to it.
Any help is greatly appreciated. Or at least a hint to the right direction. Thanks :)