summaryrefslogtreecommitdiff
path: root/doc/bugs/formbuilder_3.0401_broken.mdwn
blob: 8e5126bf64df5658904903038dcf5481f9a85f66 (plain)

After editing ikiwiki.setup, and running "ikiwiki --setup", the CGI script is successfully created. However, if I then click on "Edit Page" link, I see nothing in the browser and the following in the logs:

Can anyone decipher this for me? I spent some time with cpan earlier today downloading the latest version I could find of prerequisite modules such as HTML::Template and CGI::FormBuilder.

It would help to know what version of CGI::FormBuilder you have. Mine (3.03.01) does not seem to contain this error message. --[[Joey]]

I have version 3.0401 of CGI::FormBuilder -- the latest from CPAN. If you are wondering about any other modules, the answer is likely the same: the latest from CPAN. And you're right: the error string in question does not appear in CGI::FormBuilder. I found it in HTML::Template (version 2.8).


OK, so downgrading CGI::FormBuilder to 3.0302 makes the problem go away. I'll leave it to you to figure out whether the bug is in CGI::FormBuilder or in IkiWiki. --Steve

Maybee this bug should be renamed as "doesn't work with CGI::FormBuilder (3.04)." I get same error on FreeBSD.

HTML::Template::param() : attempt to set parameter 'form-submit' with an array 
ref - parameter is not a TMPL_LOOP! 
at /usr/local/lib/perl5/site_perl/5.8.7/CGI/FormBuilder.pm line 1415

version info:

root@freedom# pkg_info | grep p5-CGI
p5-CGI-FastTemplate-1.09 Perl module for manage templates and parses templates
p5-CGI-FormBuilder-3.0401 FormBuilder for CGI
p5-CGI-Session-4.14 Perl extension for persistent session management

--Mark


For the curious, this new version of CGI::FormBuilder changes how it passes some values to the HTML::Template template. In particular, FORM-SUBMIT used to be just a string containing the buttons used to submit the form. With the new version, it's an array of strings, one per button, and the template needs to be written differently to deal with this. Oddly, the docs have not been updated about this. In fact, from all I can tell, it's a bug, since the array is not in the form that HTML::Template expects to receive it. Here's a simple test case:

#!/usr/bin/perl
my @fields=qw(editcontent);
my @buttons=("Save", "Preview", "Cancel");

use CGI::FormBuilder;
my $form = CGI::FormBuilder->new(
        fields => \@fields,
        template => "foo.tmpl",
);
print $form->render(submit => \@buttons);

With this test case, it does not seem to be possible to write a foo.tmpl that outputs the buttons using the FORM-SUBMIT template variable.

I was able to work around this bug by just not using FORM-SUBMIT in the template, and hardcoding the buttons (since they never change anyway). Nasty, but it should work. I haven't fully installed the new version of CGI::FormBuilder to test it, and it's quite possible that other changes in the new version cause other breakage. If you want to test the fix, it's in svn now. --[[Joey]]