문제

If I am making a module, and want to have two custom paths:

path/path/path/index.htm (calls drupal_get_form)

and post to

path/path/path/result.htm

How do you do that? I get a 404 on the second path. I get the form and what I want with the first path easily enough. All I want to do is theme the form results as a drupal table and display it here.

도움이 되었습니까?

해결책 2

Got it. Implemented AHAH and all that. Forgot a parameter in my callback.

다른 팁

This looks like a good bet: http://drupal.org/node/290462

<?php
/**
* Implementation of hook_form_alter().
*/
function jm_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id) {
    $form['buttons']['submit']['#submit'][] = 'jm_redirect_handler';
  }
}

/**
* Attaches the redirect to the submitted form.
*
* @param unknown_type $form
* @param unknown_type $form_state
* @return unknown
*/
function jm_redirect_handler($form, &$form_state) {
  if ($form_state['nid']) {
    // reloading as I do not know the node type context. You probably do not need to :), just set the redirect using $form_state['nid']
    $node = node_load(array('nid' => $form_state['nid']));
    switch($node->type) {
      case 'project':
        $form_state['redirect'] = 'projects/'. $node->nid;
    }
  }
}
?>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top