开发者

drupal 6, FAPI, many instances of the same form in the same page but only the first is submitted

开发者 https://www.devze.com 2023-03-07 18:12 出处:网络
I\'m using the FAPI for building and processing a form, and I successfully created many instances of the same form on a page.Hence every form has the same input fields, but different fo开发者_如何学Go

I'm using the FAPI for building and processing a form, and I successfully created many instances of the same form on a page. Hence every form has the same input fields, but different fo开发者_如何学Gorm_id, form_build_id and form_token. The page contains a list of items and for each item I have one of these forms for processing it.

The problem is that when I submit any form, it is always submitted that one regarding the first item.

For example, if I have 3 items: item-1, item-2 and item-3. Every item has its own form with form id like "form-1", "form-2", "form-3". Then, if I submit form-3, the data passed to the _submit() function is item-1 instead of item-3.

I'm pretty sure of this behavior because with this code:

drupal_set_message('form id: ' .$form_state['values']['form_id']);

I can see that, no matter what, only the first form is submitted.

Why? Any idea?


I fonund the solution here: http://www.computerminds.co.uk/drupal-6-multiple-instances-same-form-one-page

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号