Model::DBIC with unique, inactive fields

24 views
Skip to first unread message

Russell Jenkins

unread,
Sep 19, 2012, 8:56:45 AM9/19/12
to formh...@googlegroups.com
Hey all.

I have a form that has several fields with the unique attribute, some of
which are
set to be inactive in the call to process().

With HTML::FormHandler 0.40013 and HTML::FormHandler::Model::DBIC 0.21
I'm seeing
the following error (plus the top of the stack trace)

Cannot delegate has_errors to has_errors because the value of result is
not defined at
/usr/local/strategic/perl/lib/site_perl/5.14.1/x86_64-linux-thread-multi/Moose/Meta/Method/Delegation.pm
line 99
HTML::FormHandler::Field::has_errors('HTML::FormHandler::Field::Text::10=HASH(0xaab5680)')
called at
/usr/local/strategic/perl/lib/site_perl/5.14.1/HTML/FormHandler/TraitFor/Model/DBIC.pm
line 258
HTML::FormHandler::TraitFor::Model::DBIC::validate_unique('BOiMHC::Form::MdsUser=HASH(0xabdc9e8)')
called at
/usr/local/strategic/perl/lib/site_perl/5.14.1/HTML/FormHandler/TraitFor/Model/DBIC.pm
line 56
HTML::FormHandler::TraitFor::Model::DBIC::validate_model('BOiMHC::Form::MdsUser=HASH(0xabdc9e8)')
called at /home/vagrant/perl5/lib/perl5/HTML/FormHandler.pm line 534
HTML::FormHandler::validate_form('BOiMHC::Form::MdsUser=HASH(0xabdc9e8)') called
at /home/vagrant/perl5/lib/perl5/HTML/FormHandler.pm line 411


I think the cause is due to
HTML::FormHandler::TraitFor::Model::DBIC::validate_unique calling
$field->has_error on an inactive field which has no result. Is the best
solution a patch to
check that the field is inactive or has no result before checking for
errors in validate_unique?

Cheers,
Russell.

Reply all
Reply to author
Forward
0 new messages