[Maypole] Intelligent CGI/Form processing

Marius Kjeldahl marius@kjeldahl.net
Thu, 24 Jun 2004 16:53:58 +0200


I'm trying to add a customized login template to a Maypole application. 
Differently from the "bare-bone" data forms generated auto-magically by 
Maypole and Class::DBI, the login form would typically just prompt for a 
username and a password. If the username/password pair does not match, I 
would like to redisplay the same form with an error message (should be easy 
enough), but also with the SAME username as the previous attempt.

I've done this easily using CGI.pm earlier, but have not figured out how to do 
this the best way Maypole/Template Toolkit style.

Template Toolkit has a module named Template::Plugin::CGI which does some of 
the job of CGI.pm, but not all of it. By including a [% USE CGI %] at the top 
of a template, and then later on in a form [% CGI.input ({Name => 
'username'}) %], the proper input field is displayed, but the field always 
starts out blank.

I've also tried using [% CGI.input ({Name => 'email', Default => CGI.param 
('email')}) %] (basically setting the default value explicitely), but that 
does not seem to work either.

So how are you other guys doing this effectively within Maypole/Template 
Toolkit?

Thanks,

Marius K.