drupaldrupal-forms

Drupal form validation repeat form error twice


I created custom module for render a form into a tpl file. Everything is working fine except form validation. The problem is,its showing form validation error if i enter the correct input into the form

I need to press submit button two times,Then only the error is cleared.

$form = drupal_get_form('custom_form') render $form;


Solution

  • Hook Implementation: I had resolved this issue by implementing the hook as given below

      custom_preprocess_page(&$variables)
      {
        $variables['custom_form_name'] = drupal_get_form('custom_form');
      }
    

    Template File:

    <?php print render($custom_form_name); ?>