Hi,

I've found some strange behaviours from Catalyst about CGI::FormBuilder and TT2:

example 1:

in
----- edit.tt ---
[% IF FormBuilder %]
TRUE
[% ELSE %]
FALSE
[% END %]
----- end ----

----- myapp::Controller::mycontroller ---
sub edit : Local Form {
              my ( $self, $c ) = @_;
              $self->formbuilder->method('post');   # set form method
}
------ end ----

template output returns:
TRUE

but if I call explicitly the view:
----- myapp::Controller::mycontroller ---
sub edit : Local Form {
              my ( $self, $c ) = @_;
              $self->formbuilder->method('post');   # set form method
              $c->forward($c->view('TT'));
              # and myapp::View::TT has been defined
}
------ end ----

template output returns:
FALSE

example 2:

according man CGI::FormBuilder::Template::TT2

      By default, the Template Toolkit makes all the form and field informa-
      tion accessible through simple variables.

[...] [% fields %] - List of fields
          [% field  %]  -  Hash of fields (for lookup by name)


In my template, for example to fetch label of the first_name field:

[% FormBuilder.field.first_name.label %]

but it returns anything.

While [% FormBuilder.render %] does and

[% IF FormBuilder.field %]TRUE[% ELSE %]FALSE[% END %]

returns TRUE

but

[% FOREACH f IN FormBuilder.field %]
[% f %] label: [% FormBuilder.field.$f.label %]
[% END %]

returns 'first_name' and void label.

[% FOREACH f IN FormBuilder.field %]
[% f %] has label: [% IF FormBuilder.field.$f.label %]TRUE[% ELSE %]FALSE[% END 
%]
[% END %]

returns

first_name has label: FALSE

What's kind of mistake I've done?

I've tried to subscribe the formbuilder mailing list but it's out of service.
I would like to use FormBuilder.field hash to create custom html forms.

Bye,                 \fer


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to