[Catalyst] Problem with TT view and form.field

Peter Sørensen maspsr at sdu.dk
Thu Jan 17 07:39:08 GMT 2008


Hi,

I am trying to get hold of the Template Toolkit views.

If I make a .tt2 file like

[% form.render %]

all form fields are showing up - OK.

Now I want do my own layout and as I understood the DOCS all
fields are saved in a hash field or array fields.

All my fields are  defined in a .fb file

If I do:

[% FOREACH field IN form.fields %]
	<tr>
		<td>[% field.label %]</td>
		<td>[% field.name %]</td>
		<td>[% field.field %]</td>
	</tr>
[% END %]

The output is OK but as I understood the docs it should also
be possible to access this directly.
 
 [% fields %]  -  List of fields
 [% field  %]  -  Hash of fields (for lookup by name)


Lets say I have a field named 
firstname then it should be possible to do:

[% form.fields.firstname.label %]

BUT NOTHING SHOWS UP.


I have tried to create a testhash in the controller like:

my %testhash;
$testhash{firstname} = "myname";
$c->stash->{testhash} = \%testhash;

and I have no problem using:

[% testhash.firstname %]

in the .tt2 file

What am i missing or what have I overlooked??


Regards 


Peter Sørensen/University of Southern Denmark/email: maspsr at sdu.dk



More information about the Catalyst mailing list