hi
for multigroup (cck3) with internal 'field_text' field i write:
for ($i=1; $i<count($what); $i++) {
if (!in_array($what[$i], $out)) {
form_set_error('field_text', t('error'));
}
}
//$what - array of the fields
//$out - array of valid values
//($i-1) - indexs of fields in multigroup
it works for ordinary cck field which named 'field_text'. How to write the first parameter to form_set_error for each field in multigroup? Ty
Comments
Comment #1
Luciuz commentedAlso this is the problem of ordinary multiple fields
Comment #2
Luciuz commentedfor form_set_error
'field_text' <=>(is equal) 'field_text][0][value' //[_error_element]
'field_text' (in multigroup) => 'group_name][0][field_text][value' //for text field in 0 group
but it does not work
Comment #3
Luciuz commentedi tired and i wrote code in form-page (temporarily):
$(function(){if ($s!='') :print $s;});endif;Comment #4
karens commentedI have no idea what you are trying to accomplish here. Sorry.
Comment #5
andirez commentedI hope this saves you all some time:
to target a specific field that is part of a multigroup, you can do the following:
Where field_name is the machine-readable name of the field and i is the index in the multigroup, starting from 0. You do not have to include the multigroup name.
Comment #6
jwhat commentedThanks @andirez!
Comment #7
apotek commentedKaren, I believe Luciuz was trying to report the difficulty in setting a form error on a multigrouped cck field. Andirez has a functioning answer, but it's clearly a hack.