[Templates] Default values for Textarea field
Peter Sørensen
maspsr at sdu.dk
Fri Feb 8 09:13:01 GMT 2008
Thanks for taking you time to reply.
I sure have read the DOCS and different issues concerning the textarea field.
You can't assign a "value" like you suggest. You have to do something like:
<td><textarea name= [% field.subscribers.name] rows=.... cols=...>
[% - FOREACH subscriber IN subscriber_members -%]
[%- subscriber -%]
[% END -%]
</textarea>
so I found a solution. But it is not an easy task to deal with the textarea
field through TT. This because all the extra NL give problems.
Regards
Peter
-----Oprindelig meddelelse-----
Fra: mike [mailto:pulsation at gmail.com]
Sendt: 8. februar 2008 08:48
Til: Peter Sørensen; templates at template-toolkit.org
Emne: Re: [Templates] Default values for Textarea field
On Feb 1, 2008 3:35 AM, Peter Sørensen <maspsr at sdu.dk> wrote:
>
> Hi,
>
> I'm quit new into using Template Toolkit.
> I'm using it along with Catalyst and FormBuilder
>
> Everything works fine. I can acces the fields generated by FormBuilder
> and put them whereever I like on my output with TT.
>
>
> I have a SELECT list with a preselected item and the data for the
> preselected item should show up in a textarea field.
>
> I've been wondering on how to do this. FormBuilder generates a hash of
> fields, where I can access the textarea field like:
>
> [% field = fb.field %] # formbuilder stash_name = fb
> [% field.subscribers.field %]
>
> This will put the textarea on my form but empty. How do I put some
> default values into this just using the TemplateToolkit?
man, read the docs:
http://search.cpan.org/~nwiger/CGI-FormBuilder-3.0501/lib/CGI/FormBuilder.pod#field()
the following should do what you want to do (i'm not a FormBuilder user, so i may be missing some details):
[% field.subscribers.field(value => 'some default value') %]
-mike
More information about the templates
mailing list