1

I received a pretty strange problem trying to customize custom form's template. So while form's template stay untouched (drupal core's form template was used) validation works just fine, but when I add some specific templates to my theme, validation just not working at all. Submitting a form just doesn't gives anything - MYMODULEFORM_form_validate and MYMODULEFORM_form_submit hooks are not called after form been submitted.

function MYTHEME_theme ()
{
    $items['MYMODULEFORM_1_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
        'template' => 'template_1_filename',
    );
    $items['MYMODULEFORM_2_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
        'template' => 'template_2_filename',
    );
    $items['MYMODULEFORM_3_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
        'template' => 'template_3_filename',
    );

    return $items;
}

When I print out $form variable inside the template file #validate and #submit elements are present and correct. Do you have any ideas what can cause this problem I just stucked at this. Thank you!

  • 4
    Do you have print drupal_render_children($form); at the bottom of the template file? – Clive Jul 24 '14 at 15:11
  • Now I have it! That You very much @Clive! – Elijah Jul 24 '14 at 15:27
0

SOLUTION: Was only needed to add print drupal_render_children($form); at the bottom of the template file.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.