[Catalyst] C::C::FormBuilder + TT2

Ferruccio Zamuner nonsolosoft at diff.org
Thu Feb 22 02:08:30 GMT 2007


Hi

I'm using TTSite and it renders forms if I call from TT2 [% form.render 
%], it doesn't when I try to construct custom form template.
What am I missing?

-- in Root.pm --
sub modulo : Local Form {
    my ( $self, $c ) = @_;
    my $form = $self->formbuilder;
    $form->prepare;
    $c->stash->{form}=$form;
}
--

-- in modulo.fb --
name: SBN
fields:
 field1:
   type: text
   validate: NAME
   size: 30
 field2:
   type: text
   validate: NAME
   size: 30
 field3:
   type: text
   validate: email
   label: e-mail
--

-- modulo.tt2 --
[% form.start %]

<fieldset><legend>mylegend</legend>
<p>
Some text
</p>

[% form.field.nome.field %]

</fieldset>

[% form.submit %]

[% FOREACH attr IN form.field %]
 [% attr %] [% form.field.attr.field %]
[% END %]

[% form.end %]
--

<form action="/form" id="myid" method="get" name="SBN" onsubmit="return validate_SBN(this);">
<fieldset><legend>mylegend</legend>
<p>
Some text
</p>

</fieldset>
<input id="SBNbiblio_submit" name="_submit" type="submit" value="Submit" />
 field1 

 field2 

 field3
</form>


Another question about Catalyst and FormBuilder:
On latest FormBuilder version (3.05), it is possible:

 $form->new(template => {type => 'div'});

Where I can add such argument for template attribute to C::C::FormBuilder?


Thank you in advance for any reply. Bye,            \fer




More information about the Catalyst mailing list