If you have a configurable action ie one which has a form to be filled out (eg the "Send e-mail" action), it's possible to not fill in the form correctly. Drupal goes to the _validate() function which sets the FAPI error stuff up properly and returns you to the form, with the erroneous fields highlighted. However, none of the fields in the form (not even those which were filled in correctly) are pre-populated as they should be.

This is because the _form($context) function isn't getting a $form_state like a hook_form() would. I know VBO's use of _form() isn't really an instance of hook_form() but we do need some way of getting the $form_state through. Other core examples such as http://api.drupal.org/api/function/system_goto_action_form/6 expect the form state to come through the $context. In the goto action example just given, the field pre-population code is such:

    '#default_value' => isset($context['url']) ? $context['url'] : '',

This concept just doesn't work with VBO's forms, as $context doesn't pass around any previous values of the form fields like it should.

One possible fix is to add $form_state as an argument to _views_bulk_operations_action_form(). Then inside _views_bulk_operations_action_form(), pass the $form_state through to the action's x_form() function via the call_user_func().

Let me know if you'd like a patch.

Jeff

Comments

infojunkie’s picture

Errors in action forms do fill in existing values on my test installation. Can you please try the dev version of VBO? I tested with several actions including "Send e-mail".

infojunkie’s picture

Status: Active » Closed (fixed)

Closed unless I hear back from OP.