[html-formfu] non-processing actions, WAS: Date element stopped
working
Byron Young
Byron.Young at riverbed.com
Tue Mar 25 21:53:09 GMT 2008
> -----Original Message-----
> From: vti [mailto:viacheslav.t at gmail.com]
> Sent: Tuesday, March 25, 2008 8:15 AM
> To: html-formfu at lists.rawmode.org
> Subject: Re: [html-formfu] non-processing actions, WAS: Date
> element stopped working
>
> Carl Franks(fireartist at gmail.com)@Tue, Mar 25, 2008 at 01:45:06PM
> +0000:
> > On 25/03/2008, vti <viacheslav.t at gmail.com> wrote:
> > >
> > > I created sample Cat app and behaves the same as my app. Sorry
> for the name, but
> > > it is what I fill now :)
> >
> > ah, the problem is that you're setting the default() after the
> > FormConfig action calls $form->process.
> >
> > If you make any changes to the form, you need to add a
> > $form->process() before returning from the action subroutine.
> >
> > What would be ideal - and I think has been discussed before -
> would be
> > a FormConfig action that doesn't automatically call process() -
> as it
> > can be an expensive and possibly destructive method to call
> twice.
> >
> > I think I was initially worried about an explosion of action
> names, as
> > we already have:
> > Form
> > FormConfig
> > FormMethod
> > MultiForm
> > MultiFormConfig
> > MultiFormMethod
> >
> > Adding non-processing actions would immediately double that
> number.
> >
> > Maybe something like
> > FormConfig('process=0')
> > FormConfig('config-file', 'process=0')
> > would be better than adding new action names.
> >
> > It might get hairy handling all possibilities though, as the
> > attributes don't really support multiple arguments, so we'd have
> to
> > parse the strings ourselves.
> > fex, with the above example we'd actually get something like:
> > $VAR1 = "config-file\', \'process=0"
> >
> > Carl
>
> But why Text field changes and Date does not? Almost in every
> controller I do
> have FormConfig attr on a sub method and inside I do
> $form->model('DBIC')->default_values( $dbic_object ) and it seems
> like
> working... If I correctly understood you - this shouldn't work
> either..
>
> Appreciate your time and help. Thanks a lot.
>
> --
> vti -- Viacheslav Tikhanovskii
>
If you look at the HTML::FormFu::Element::Date code, you can see that Date only parses the 'default' attribute in _date_defaults(), which is called in _add_elements(), which is called in -- you guessed it -- process().
Regards,
Byron
More information about the HTML-FormFu
mailing list