When add or edit a node and click submit, it take to the node I just made -

How can I change the redirecting so I get taken to the edit screen of the node I just created?

Comments

beautifulmind’s picture

If you wanna do some coding, try following.
Create a module. And write following code in.

 hook_form_alter($form_id, $form) {
  if ($form_id == '<node type you want to redirect>_node_form') {
    $form['#redirect'] = '<url you want to redirect to>';
  }
 }

:)

Beautifulmind
Know more

Regards.
🪷 Beautifulmind

cybershan’s picture

thanks for you quick response

Mmmm..... I have no idea about how to create a module.

Actually, I have created the template.php with below code

function phptemplate_node_form($form) {
  if(file_exists(path_to_theme().'/'.$form['type']['#value'].'_form.tpl.php')) {
    return _phptemplate_callback($form['type']['#value'].'_form', array('user' => $user, 'form' => $form));
  }
}

and customize the form (article_form.tpl.php) which I don't know how to set the redirecting.


        print drupal_render($form['group_collect']['field_collect_name']);
        print drupal_render($form['group_collect']['field_collect_address1']);
        print drupal_render($form['group_collect']['field_collect_address2']);
        print drupal_render($form['group_collect']['field_collect_address3']);
        print drupal_render($form['group_collect']['field_collect_address4']);
        print drupal_render($form['group_collect']['field_collect_city']);
        print drupal_render($form['group_collect']['field_collect_country']);
        print drupal_render($form['group_collect']['field_collect_contact_person']);
        print drupal_render($form);

Can I just insert your code somewhere on these two php files?

beautifulmind’s picture

Well, this is Drupal community, so without any doubt you can use my code!

:)

Beautifulmind
Know more

Regards.
🪷 Beautifulmind

cybershan’s picture

Sorry, I mean where should I paste this code.

I just do a test on my article_form.tpl.php file as below:

         $form['#redirect'] = 'frontpage';
        print drupal_render($form['group_collect']['field_collect_name']);
        print drupal_render($form['group_collect']['field_collect_address1']);
        print drupal_render($form['group_collect']['field_collect_address2']);
        print drupal_render($form['group_collect']['field_collect_address3']);
        print drupal_render($form['group_collect']['field_collect_address4']);
        print drupal_render($form['group_collect']['field_collect_city']);
        print drupal_render($form['group_collect']['field_collect_country']);
        print drupal_render($form['group_collect']['field_collect_contact_person']);
        print drupal_render($form);

But it doesn't work..

spread drupal’s picture

Hi,,

You can write form alter hook in your custom module .. and put condition that checks form_id

function module_name_form_alter($form_id,$form){

if($form_id == 'articles_node_form'){
$form['#redirect'] = 'http://google.com';
}

}

http://spreaddrupal.org
spread drupal everywhere

cybershan’s picture

Drupal version is 5.x. :)