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
精彩评论