[development] Problem with hook_form_alter: Cannot unset string offsets

Pierre Rineau pierre.rineau at makina-corpus.com
Mon Jun 28 15:10:28 UTC 2010


Le lundi 28 juin 2010 à 10:59 -0400, Jeff Greenberg a écrit :
> Hi Pierre,
> I'll do that regarding the type, thanks. So, by 'take care of'... the 
> original field is an autocomplete text field, and I'm thinking you mean 
> that I should disassemble it (or at least unset it) first, rather than 
> have array keys still present with the 'value' type leftover from the 
> text field?
> 
> Jeff

I did not meant that, but yes, you also should do that! I mean CCK
fields are sometime a complex form structure.

As a start, any multiple content field sub form is itself an array of
this particular field type single value sub form, if it's configured as
multiple.

Even the single value sub form, for some particular types, can be a
complex structure of form elements, that is not the case with node
reference (as I could remember, but I could be wrong). In this case, you
have to set an array of value form elements that matches the current
existing values (or the new one you want to add).

Pierre.





More information about the development mailing list