Submit Again

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

  1. $form['buttons']['submit_again'] = array(
  2.   '#type' => 'submit'
  3.   ,'#value' => t('Save and create another')
  4.   ,'#weight' => 41
  5.   ,'#submit' => array('node_form_submit', 'submitagain_node_form_submit')
  6. );

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

  1. function submitagain_node_form_submit($form, &$form_state) {
  2.   $form_state['redirect'] =   'node/add/'. str_replace('_', '-', $node->type);
  3. }
Tags: 

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.