Is there a way to move the submit button for a bulk operation to the top of the form in the same fieldset where the options are selected? Many of my users would rather have the button at the top instead of the bottom. Or alternatively can the button be available in both locations?

The option for Display operations as "Each action as a separate button" is not an option for me as the field in question are cck fields

Comments

arvinsingla’s picture

So I've almost solved my problem completely after posting this. Realized I could use a hook_form_alter to copy the submit button and change the weight so I would have a second submit button at the top of the list. Did some brief testing and everything seems to work.

Here's my hook for anyone interested


function mymodule_form_alter(&$form, $form_state, $form_id) {
  if ($form_id = 'views_bulk_operations_form__1') {
	$form['submit2'] = $form['submit'];
	$form['submit2']['#weight'] = -99; 
  }
}

The only thing I'm not sure about is how to put the submit button inside the table element where the select list options are. Any ideas?

infojunkie’s picture

Do you mean the submit button for the case of one action only?

mstef’s picture

+1

Exploratus’s picture

Subsribe

infojunkie’s picture

Status: Active » Fixed

fixed in the latest dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xcafebabe’s picture

And if I want to move the submit button for a bulk operation to the bottom of the page? Solution proposed in #1 didn't work for me . Any suggestion?

sandu.camerzan’s picture

For Drupal 7 the following code worked for me - VBO operations displayed as buttons, at bottom of the output table:

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if (strpos($form_id,  'your_vbo_form_id') !== FALSE) {
      $form['output']['#weight'] = -99; //Decrease the weight of output to rise it above other elements.
  }
}
smurfxx’s picture

Issue summary: View changes

Sorry for the question but where do I have to put the code of #8?

paulihuhtiniemi’s picture

Tested form alter in #8 with 3.2 version, doesn't seem to help :/

sirnjeet’s picture

Sorry, posted to wrong thread. Comment deleted.

bisonbleu’s picture

Ran into this issue. Code in #8 works perfectly. Thanks @sandu.camerzan!

I used the more specific hook_form_FORM_ID_alter() in an existing custom module.

I'm using Views 7.x-3.8 and VBO 7.x-3.2 in a Drupal 7.32 install.

bisonbleu’s picture

Title: Move submit button to top of form » Move submit button to top/bottom of form

Updated the title to reflect sub-issue.

Collins405’s picture

Jeez this is annoying, spent ages trying to push the submit form down, didnt think about raising the output! (face palm)

Thanks!

kopeboy’s picture

this and #2410873: Moving the operations block to the bottom of the page (for every vbo form) work.

Keep in mind you cant use form_alter function twice in the same module.

rfletcher73’s picture

why isn't the submit button one of the elements in the form? I would love that! Then i can make a custom layout and put the field in the first region and the submit button in the second region.