[html-formfu] Confusing error with File element
Gabor HALASZ
halasz.g at freemail.hu
Sun Oct 16 21:56:40 GMT 2011
Hi!
I created a logicaly wrong from config when I extend my form with a file
element. I created the config:
filter TrimEdges
filter HTMLEscape
filter HTMLScrubber
<elements>
...
<elements>
type File
name image
label_loc form.element.label.image
<attributes>
title form.element.title.image
</attributes>
</elements>
...
</elements>
The form rendered well, but when I tried to process a sumbitted and
validated form:
$upload = $c->stash->{form}->param_value('image');
$c->log->debug( 'CP: ' . Dumper $upload );
$c->log->debug( 'CP: ' . $upload->filename );
$c->log->debug( 'CP: ' . $upload->size );
$c->log->debug( 'CP: ' . $upload->type );
$blob = $upload->slurp if( defined( $upload ) );
I got the confusing error:
[debug] File Uploads are:
.--------------+----------------------------+--------------------+-----------.
| Parameter | Filename | Type | Size
|
+--------------+----------------------------+--------------------+-----------+
| image | NoPicture.png | image/png |
191780 |
'--------------+----------------------------+--------------------+-----------'
...
[debug] CP: $VAR1 = 'HTML::FormFu::QueryType::Catalyst=HASH(0x80c6ea918)';
[error] Caught exception in App::Controller::Product->create "Can't
locate object method "slurp" via package
"HTML::FormFu::QueryType::Catalyst=HASH(0x80c6ea918)" (perhaps you
forgot to load "HTML::FormFu::QueryType::Catalyst=HASH(0x80c6ea918)"?)
at ...
Of course, this exception caused by a wrong placed filters, but why lost
all methods from H:F:Q:C?
I spent 2 hours to solve this situation, the exception directed me to a
wrong way, and I tried to figure out a problem in H:F code instead in my
form config :(
My versions:
p5-HTML-FormFu-0.09005
p5-HTML-FormFu-Model-DBIC-0.09000
p5-Catalyst-Runtime-5.90003
Thanks
--
Gabor HALASZ <halasz.g at freemail.hu>
More information about the HTML-FormFu
mailing list