Re: [Templates] beginner's question

[prev] [thread] [next] [Date index for 2005/05/18]

From: merlyn (Randal L. Schwartz)
Subject: Re: [Templates] beginner's question
Date: 20:12 on 18 May 2005
>>>>> "Warren" == Warren Pollans <wpollans@xxxxx.xxx> writes:

Warren> Using the following works - I get a popup and a submit button
Warren> [% USE CGI;
Warren> CGI.start_form;
Warren> CGI.popup_menu(
Warren>      Name => 'color',
Warren>      Values => [ 'red', 'green', 'blue' ]);
Warren> CGI.submit;
Warren> #CGI.end_form;
Warren> %]


Warren> If I uncomment the end_form line, I get the popup and button PLUS an
Warren> arrayref - ARRAY(0xb0cbe4) - after the button.   What am I missing?

There are a few "evil" CGI.pm HTML shortcuts that generate multiple elements,
and so they show up as ARRAY(0x...) in your output.  I don't know a rule
for it, but almost all of the "group" input items do (the ones that
take a hashref or array ref to generate multiple things).

The solution is to tack a tacky .join("") on the end, as in:

   CGI.popup_menu( ... ).join("");

That's what I've been using.  If there's a simpler solution (Andy?)
I'm all for it.

        -- 
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@xxxxxxxxxx.xxx> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] beginner's question
Warren Pollans 19:43 on 18 May 2005

Re: [Templates] beginner's question
Todd Freeman 20:04 on 18 May 2005

Re: [Templates] beginner's question
merlyn (Randal L. Schwartz) 20:12 on 18 May 2005

Generated at 15:56 on 25 May 2005 by mariachi v0.52