Grokbase
Topics Posts Groups | in
x
[ help ]

Вячеслав Тихановский (viaches...@gmail.com)

Profile | Posts (1)

User Information

Display Name:Вячеслав Тихановский
Partial Email Address:viaches...@gmail.com
Posts:
1 total
1 in HTML::FormFu

5 Most Recent

1) Вячеслав Тихановский Re: [html-formfu] non-processing actions, WAS: Date element stopped working
| +1 vote
Zbigniew Lukasiak(zzbbyy@gmail.com)@Tue, Mar 25, 2008 at 02:55:12PM +0100: Maybe it is ok just not...
HTML::FormFu
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Zbigniew Lukasiak([email protected: z...@gmail.com])@Tue, Mar 25, 2008 at 02:55:12PM +0100:
> I know this will sound extreme, but frankly, I would just entirely
> scratch the whole Catalyst::Controller::HTML::FormFu and leave it only
> as a POD describing the available integration possibilities. There is
> rather not much of code there and with so many options it is spread
> very thin.
>
> And additionally multiple inheritance causes no end of problems - so
> it is advisable to avoid forcing users to 'use base' to use your
> library.
>
> Cheers,
> Zbigniew
>
> On Tue, Mar 25, 2008 at 2:45 PM, Carl Franks <fireartist@gmail.com> wrote:
> > On 25/03/2008, vti <viacheslav.t@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

Maybe it is ok just not to call ->process inside of FormConfig and not bother
about flags and stuff? It's up to the user when it is time to build the form
and FormConfig just creates config :-)

--
vti -- Viacheslav Tikhanovskii

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.rawmode.org]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
2) Вячеслав Тихановский Re: [html-formfu] non-processing actions, WAS: Date element stopped working
| +1 vote
vti(viacheslav.t@gmail.com)@Tue, Mar 25, 2008 at 05:14:50PM +0200: Meanwhile I removed FormConfig...
HTML::FormFu
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
vti([email protected: viaches...@gmail.com])@Tue, Mar 25, 2008 at 05:14:50PM +0200:
> Carl Franks([email protected: firea...@gmail.com])@Tue, Mar 25, 2008 at 01:45:06PM +0000:
> > On 25/03/2008, vti <viacheslav.t@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.

Meanwhile I removed FormConfig and cut some code from that module and everything
works like you wrote. Sorry for my confusion :(

Thanks a lot!

--
vti -- Viacheslav Tikhanovskii

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.rawmode.org]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
3) Вячеслав Тихановский Re: [html-formfu] non-processing actions, WAS: Date element stopped working
| +1 vote
Carl Franks(fireartist@gmail.com)@Tue, Mar 25, 2008 at 01:45:06PM +0000: But why Text field changes...
HTML::FormFu
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Carl Franks([email protected: firea...@gmail.com])@Tue, Mar 25, 2008 at 01:45:06PM +0000:
> On 25/03/2008, vti <viacheslav.t@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

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.rawmode.org]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
4) Вячеслав Тихановский Re: [html-formfu] Date element stopped working
| +1 vote
Carl Franks(fireartist@gmail.com)@Tue, Mar 25, 2008 at 09:45:51AM +0000: Thanks for the reply... I...
HTML::FormFu
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Carl Franks([email protected: firea...@gmail.com])@Tue, Mar 25, 2008 at 09:45:51AM +0000:
> On 24/03/2008, vti <viacheslav.t@gmail.com> wrote:
> > After updating to the current html-formfu Date element stopped working on
> > default_values(), though it works on update().
>
> There's only been 1 minor change to the Date element between v0.02000
> and v0.02004 - and it shouldn't have had any effect.
> However, there has been a lot of changes in svn since v0.02004 - can
> you update to the latest svn version, and let me know if that works.
>
> If it still doesn't work, you'll need to do some more digging.
> All tests pass, so there's unlikely to be a major problem.
>
> Are you using blocks with nested_name() at all?
> default_values() expects you to use the full nested-name for all fields.

Thanks for the reply...

I must admit that `default_natural: 'today'' works and adding to the db through
DBIC model works too, but getting it out and filling the form doesn't.
Everything except Date element works in the both directions. I am using MySQL,
my conf looks like:

---
attributes:
  class: formfu
elements:
  - type: Text
    name: title
    label_loc: 'formx_label_title'
    constraints:
      - type: Required
        message_loc: 'formx_constraint_required'

  - type: Date
    name: endtime
    strftime: '%Y-%m-%d'

  - type: Submit
    name: submit
    value_loc: 'formx_value_submit_save'

constraints:
  - SingleValue

When I try something like:

    $form->get_element('title')->default('foo');
    $form->get_element('endtime')->default('2008-05-06');

Title is filled with the `foo' value and date doesn't :-(

--
vti -- Viacheslav Tikhanovskii

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.rawmode.org]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
5) Вячеслав Тихановский Re: [html-formfu] Date element stopped working
| +1 vote
vti(viacheslav.t@gmail.com)@Mon, Mar 24, 2008 at 07:19:30PM +0200: Seems like: $form->get_element(...
HTML::FormFu
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
vti([email protected: viaches...@gmail.com])@Mon, Mar 24, 2008 at 07:19:30PM +0200:
> After updating to the current html-formfu Date element stopped working on
> default_values(), though it works on update().

Seems like:

$form->get_element( 'starttime' )->value(
    strftime "%Y-%m-%d %H:%M", localtime
);

doesn't work either.. :-(


--
vti -- Viacheslav Tikhanovskii

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.rawmode.org]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

spacer
Profile | Posts (1)
Home > People > Вячеслав Тихановский