If I create a Rules Action to set the value of a CCK field, and point to that action from VBO, is there a way to add user inputs to the VBO form on the views page to pass parameters to the Rules Action?

I would prefer a way to do this through GUI if possible.

1 Answer 1


Explaining how to create Rule that accept arguments (user can enter any value) and adding VBO field in Views: The Power of Rules with Views Bulk Operations (and Commerce)

From Joren comment:

 function modulename_form_views_form_test_view_page_alter(&$form, $form_state, $form_id) { 
    $form['#submit'][] = 'modulename_vbo_submit'; 
    $form['select']['arg'] = array( '#type' => 'textfield', '#title' => t('Whatever') ); 
 function modulename_vbo_submit(&$form, $form_state) { 
   $nids = $form_state['selection']; 
   foreach ($nids as $nid) { 
     $node = node_load($nid); 
     rules_invoke_component('rules_test', $node, $form_state['values']['arg']); 
  • This is almost exactly what I needed. The only missing piece is getting the form field to be on the same page as the view. I don't like the intermediate step for entering that value.
    – Joren
    Commented Oct 10, 2011 at 19:07
  • well, in this case you can only write custom module.
    – Nikit
    Commented Oct 10, 2011 at 20:24
  • 1
    Can the custom module just move the form to the views page, but the rest of the functionality come from the Action? If so, do you know how?
    – Joren
    Commented Oct 10, 2011 at 20:45
  • I assume you can catch VBO form in Views via hook_form_alter and adding input box there, then adding own submit with calling rules action.
    – Nikit
    Commented Oct 10, 2011 at 21:23
  • I can't figure out how to call a rules action. :\ Being able to add arguments is great, but having it be a separate step makes it fairly poor for something users are supposed to use.
    – Joren
    Commented Oct 11, 2011 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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