[Templates] Default values for Textarea field

mike pulsation at gmail.com
Fri Feb 8 07:48:16 GMT 2008


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