We are using panels to display two (more than one) views with bull operations forms. They are not working :(

After some research we found that both bulk operations forms are using the same form_id... And this is obvious while the callback function drupal_get_form() is called with the same callback arguments 'views_bulk_operations_view_settings'.

We need a way to give a different ID to each instance of the bulk operations form... But how?

Comments

claudiu.cristea’s picture

Version: 5.x-1.x-dev » 5.x-1.0
infojunkie’s picture

Category: bug » feature

Interesting issue :-)

I reproduced the behavior on my side, and a little searching revealed that hook_forms is the mechanism used to give different IDs to different instances of the same form. In our case, we need to account for both forms 'views_bulk_operations_view_settings' and 'views_bulk_operations_form'.

I won't be able to look into that request for a while because of my current bug backlog. I will be grateful if you can look into it :-)

claudiu.cristea’s picture

Thanks kratib... Indeed, the hook_forms() function is the way to fix the issue. I found a very useful story at Drupal 5: How to process multiple instances of the same form on the same page.

I will look into and I will try to provide a patch... Do you have some idea regarding the suffix? Shall we use incremental numbers? Shall we use the view name (...in our case each form instance is a different view)?

claudiu.cristea’s picture

Status: Active » Needs review
StatusFileSize
new1.98 KB

I'm here with a first patch... I had used the view name as suffix of the form ID... This will solve my case but... don't know what if there are multiple instances of the same view in the same page... Maybe the numeric incremental suffix can be a better way.

claudiu.cristea’s picture

StatusFileSize
new2.07 KB

I've also created a patch for numeric incremental suffix (... which I think is the right way!).

PS: I don't think that the 'views_bulk_operations_view_settings' form need to be included in this patch. There is no circumstances where this form should appear in more than one instance on a single page.

infojunkie’s picture

Assigned: Unassigned » infojunkie
Status: Needs review » Fixed

Pretty groovy! Thanks for the patch, seems to be working fine, I'm checking it in and will apply it to D6 as well.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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