technonaturalist

image link to hive image link to ko-fi

Drupal 7 notes: the submit button on the node creation form isn't working!

posted on: Thursday, 23 June 2011 @ 1:44pm in
tagged

In template.php:

<?php 
function [theme-name]_theme($existing, $type, $theme, $path)
  {
    return array
        (
        '[content-type]_node_form' = array(
            'render element' =>
            'form', 'template' => 'node--[content-type]-form', )
        );
    } 
?>

If you keep template files in a subdirectory (eg sites//all/themes/[theme-name]/templates or something to that effect) this may help:

    'path' => drupal_get_path('theme', '[theme-name]') . '/subfolder',

After you’ve put all your fields where you want them in your pretty node--type.tpl.php:

<?php
  echo render($form['title']);
  echo render($form['field_[field_name]']);
  // etc
 // with whatever formatting around it
?>

At the end put

<!?php echo drupal_render_children($form) ?>

That renders all those sneaky little hidden fields Drupal uses to process and validate form stuff. Use css to hide the vertical tabs if you want them hidden.

#[formid] .vertical-tabs { display: none; }