Drupal FAPI: Add form elements on nodeform after validation

Posted by ManuelBS on Stack Overflow See other posts from Stack Overflow or by ManuelBS
Published on 2010-05-22T09:46:22Z Indexed on 2010/05/22 9:50 UTC
Read the original article Hit count: 412

Filed under:
|
|
|
|

Hi, I use Drupal 6.x. In my own module I alter each node form an add my own validation handler to it using

$form['#validate'][] = 'my_own_validation_function';

Then I have the function

function my_own_validation_function($form, &$form_state)
{
  //if validation fails, i would like to rebuild the form to add additional form elements in hook_form_alter
  $form_state['rebuild'] = True;
}

My problem ist, that the validation functions does not respect my 'rebuild' = True becaus the form is never processed by hook_form_alter after validation. But I need hook_form_alter to add my additional form element.

Is there a solution for my problem? Or are form_state changes in an own validation handler not respected even if I set &$form_state as a "pointer"?

Thanks and cheers.

© Stack Overflow or respective owner

Related posts about validation

Related posts about api