Fragmented Thought

Drupal - Submit Again

By

Published

Lance Gliser

Heads up! This content is more than six months old. Take some time to verify everything still works as expected.

Add a second button to the form, make sure there is an additional submit function included:

$form['buttons']['submit_again'] = array( '#type' => 'submit' ,'#value' => t('Save and create another') ,'#weight' => 41 ,'#submit' => array('node_form_submit', 'submitagain_node_form_submit') );

After that, it's a simple matter of using the extra function for routing purposes:

function submitagain*node_form_submit($form, &$form_state) { $form_state['redirect'] = 'node/add/'. str_replace('*', '-', \$node->type); }