I built a custom content type (not cck), and the form does everything right at the node/add/mytype page.

But I'm also displaying the form on another page /mycustompath, (this page is also set to be front) the form submits on this new page, but when there are form errors, no messages are printed.

To get my other form, I'm hooking hook_forms with the new form name and setting the callback to be node_form

/**
 * Implementation of hook_forms().
 *
 */
function jack_request_forms(){
  $forms = array();

  if($form_id == 'jack_request_on_profile_form')
    $forms[$form_id] = array(
      'callback' => "node_form",
    );

  return $forms;
}

I've tried explicitly setting form errors in the form validate hook, but still nothing displays, in fact, $_SESSIONS['messages'] is empty.

Don't if it matters, but I'm using a menu_hook for my custom page, and then relying on phptemplate to use the page-mycustompath.tpl.php file, where all my theming is done. Here's a sample:

            <div id='request-form' class='jack_request_on_profile'>
              <?php
              print $messages;
              ?>
            <h2>Make a Request</h2>
            <?php
              global $user;
              $new_request = array('uid'=>$user->uid, 'name' => $user->name, 'type' => 'jack_request');
            ?>
              <?php print drupal_get_form('jack_request_on_profile_form', $new_request); ?>
            </div>
          </div>

Any clues?

Comments

emackn’s picture

nothing? No comments?

gpk’s picture

Sounds like the validate handler isn't getting called when the form is submitted from your custom path. Possibly you need to set it as a validate handler by hand.

gpk
----
www.alexoria.co.uk

emackn’s picture

hmm.. ill give that a try, thanks.