Hi everyone,
While form_set_error('field_firstname', t('message'));
works fine, how can I do the same for one of several taxonomy fields? e.g. form_set_error('taxonomy[5]', t('message'));
(which doesn't work). Can anyone help?
Hi everyone,
While form_set_error('field_firstname', t('message'));
works fine, how can I do the same for one of several taxonomy fields? e.g. form_set_error('taxonomy[5]', t('message'));
(which doesn't work). Can anyone help?
Found the answer. Here it is, for anyone who might have the same problem:
If the #parents property of your form element is array('foo', 'bar', 'baz') then you may set an error on 'foo' or 'foo][bar][baz'. Setting an error on 'foo' sets an error for every element where the #parents array starts with 'foo'.
So form_set_error('taxonomy][5', t('message'));
works perfectly.