I have got a form defined that is displayed multiple times on a single page. For each instance of the form, different values (node ids) are inserted into the hidden fields, which seems to be there once the form is rendered.
However, when I submit any of the forms on the page, the submit handler always gets the values that have been inserted for the first instance and I can't seem to get hold of why this is happening.
One thing that I noticed though is that all of my forms have the same form_id, form_token and only the form_build_id changes.
Any idea why this is happening, I can't find a solution to this problem anywhere.
Thanks a lot.
Code:
I'm attaching the form to the nodes in hook_node_view like this:
$node->processed['add_collection_form'] = drupal_get_form('add_to_collection_form', $node->nid);
when I try to do it in hook_node_load drupal always complains about the memory limit in PHP even though I have set it to a generous 1GB, which is pretty weird.
The form on the page are rendered the standard way:
print drupal_render($node->processed['add_collection_form']);
in node--.tpl.php