views:

20

answers:

1

I have a problem with multiple forms in one page with inputs sharing the same key.

I have a form in a page and another form in a block showing on the same page.

Both forms have a field name exactly the key name (mail). I can't change those field's keys or I would break 2 modules.

So, whenever I try to post the page form and the mail is missing (it's required), I'm taken to the same page with that field marked red (which is correct) but the block form is also marked (which is wrong, because I was filling the page form, no the block).

Does anybody know how to avoid this behavior? I'm thinking about hook_form_alter(), or even theme_preprocess_block(), but before reinventing the wheel... well, you know.

Thanks in advance!

A: 

Maybe try adding an extra validate function to the block form and if all fields are blank, then do the following:

form_set_error(NULL, '', TRUE);
$form_state['rebuild'] = TRUE;
Matt V.