0

I need to change the submit and preview button order in the node edit form in Drupal 7. By default the submit button shows first the preview button, But I need vice versa.

How can I achieve this?

2

One solution is to use hook_form_alter() in a custom module to make the submit button heavier than the preview button:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {

  if($form_id == 'MYNODETYPE_node_form') {
    $form['actions']['preview']['#weight'] = $form['actions']['submit']['#weight']-1;
  }
}

Just change the module name and form id accordingly.

  • can we remove the node form on preview page .? – jsh Sep 17 '15 at 6:39
  • Please ask that as a new question. Chatty threads with multiple questions are discouraged here. – Shawn Conn Sep 17 '15 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.