Community

Form API: Weighting for "Save" and "Preview" buttons?

Hi

When generating content defined by hook_form, can weighting be assigned to the default provided Save and Preview buttons?

I have a couple of forms whereby all the form elements are weighted as expected, but the Save and Preview buttons are NOT being displayed at the bottom; but interspersed within the other form elements.

Thanks

Jeff in Seattle

Comments

Found answer...

Found answer here http://drupal.org/node/373027

Within hook_form_alter(), for form in question as identified by $form_id, provide the following:

<?php
function my_custom_module_form_alter(&$form, $form_state, $form_id) {
  if (
'my_custom_module_node_form' == $form_id ) {   
   
$form['buttons']['#weight'] = 100;
  }
}
?>

Cheers

Jeff in Seattle

Jeff in Seattle

nobody click here