Hi Jason,

Thanks for looking into the problem. I have tried your
suggested syntax but still no output.

I can access the information with:

        form.field.3.label

where 3 is the index in the array but this is not what I want.
I want to be able to address the content using the name of the field.

regards

Peter
                                
                
-----Oprindelig meddelelse-----
Fra: Jason Kohles [mailto:[EMAIL PROTECTED] 
Sendt: 17. januar 2008 15:49
Til: The elegant MVC web framework
Emne: Re: [Catalyst] Problem with TT view and form.field

On Jan 17, 2008, at 2:39 AM, Peter Sørensen wrote:

I don't know much about FormBuilder, however...

> 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)

These are actually exactly the same method in CGI::FormBuilder, which
says:

*param  = \&field;
*params = \&field;
*fields = \&field;
sub field {

>
> Lets say I have a field named
> firstname then it should be possible to do:
>
> [% form.fields.firstname.label %]


The source for CGI::FormBuilder says that field, if called without an argument, 
will return "an array of the names in list context, and a hashref of name/value 
pairs in a scalar context".  This is problematic behavior with TT, as TT always 
uses a list context, so form.fields and form.field are both going to return an 
array of field names.

Looking at the source though, it looks like you should be able to get at them 
this way:

[% form.field( 'firstname' ).label %]

--
Jason Kohles, RHCA RHCDS RHCE
[EMAIL PROTECTED] - http://www.jasonkohles.com/ "A witty saying proves 
nothing."  -- Voltaire



_______________________________________________
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/

_______________________________________________
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