[html-formfu] HTML::FormFu::Element::DBIC::Select for review

Mario Minati mario.minati at googlemail.com
Sat Sep 22 22:30:44 GMT 2007

On Thursday 20 September 2007 11:08:51 Zbigniew Lukasiak wrote:
> Hi Mario,
> Just today I found a quite concrete example.  Form for editing a
> record - with a 'has_many' relation. I need to load all the records
> from the related table as options to a SELECT - and then I would like
> to *set on all the options that correspond to records from the foreign
> table that currently related to the main record*.  After that I would
> like to render the form.

I'm not sure if I understand that correct, but can't it be done with 
the 'default' function to set the 'selected' attribute.

> This looks to me like a very standard need - and it is a good example
> of why you sometimes need to *alter the created options of a SELECT*.

What about a callback function that is called when preparing the options just 
before the options are saved in the Select element.

Do you have anyexperience or ideas on how we can define the callback from yml? 


> --
> Zbyszek
> On 9/19/07, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
> > On 9/19/07, Mario Minati <mario.minati at googlemail.com> wrote:
> > > On Wednesday 19 September 2007 14:56:16 Zbigniew Lukasiak wrote:
> > > > This argument gets a bit out of proportions - so I will not extend
> > > > it.
> > >
> > > Didn't want to set you up. Generalising can get difficult (for me)
> > > without cases in (my) mind.
> >
> > Thanks Mario for your patience.  I really like the 'search' and
> > 'where' attributes you introduced - this should make it quite general
> > solution and perhaps the change that I propose will not be needed by
> > anyone.  But I'll try to explain myself once again.
> >
> > What I am trying to say is that it is easier to manipulate something
> > that you see then something unvisible.  It is easier to manipulate the
> > Select element when you see it's options then when it does not have
> > any options but you know that at some point in the future they'll be
> > added.  This is the same when you create the element by
> > 'load_config_file' and want to change it somehow via overriding a
> > method and when you create it 'by perl' and want to change it by
> > directly adding something to it 'by perl'.
> >
> > More directly: when you need to change some of the options - modify
> > them (set some of them 'on') or delete some of them or add some others
> > (like the 'choose country' option) you need to have access to them and
> > if they only appear at when the form is rendered this might be too
> > late.
> >
> > And another point - you are now overriding two methods - what I
> > propose is to override just one.
> >
> > Finally I found that populate is actually not called for every element
> > - and what should be overriden instead seems to be 'new' or perhaps
> > 'setup'.
> >
> > Cheers,
> > Zbyszek

More information about the HTML-FormFu mailing list