[html-formfu] $_->render_data->{value} returns only the first
value for a many_to_many relationship
Carl Franks
fireartist at gmail.com
Mon Mar 24 13:15:03 GMT 2008
On 24/03/2008, Moritz Onken <onken at houseofdesign.de> wrote:
> Am 24.03.2008 um 13:51 schrieb Carl Franks:
>
> > On 24/03/2008, Moritz Onken <onken at houseofdesign.de> wrote:
> >> Hi,
> >>
> >> I'm using $_->render_data->{value} to get a value of a field which
> >> got
> >> the data via $form->defaults_from_model.
> >> If I try $_->render_data->{value} on a many_to_many relationship I
> >> only get the first value but not all of them. The element type is
> >> Select with multiple set to 1.
> >> How can I get all (deflated) values?
> >
> > _Group.pm should probably override _Field.pm's handling of ARRAY
> > values in _render_value()
> >
> > This has never been an issue, because the appropriate
> > selected="selected" work is done in Select.pm's _prepare_attrs(), so
> > $self->render_value->{value} has never been needed before.
> >
> > Carl
>
>
> thanks Carl,
> but could you tell me a way how I can get all deflated values of such
> an element?
deflation is done during _process_value(), so if both its `if (ARRAY)`
blocks are moved out into new, separate methods that _Group.pm can
override, you won't have to worry about that.
btw, I think _Group.pm will probably also need to override
process_value() (the non-private method)
Carl
More information about the HTML-FormFu
mailing list