Seasons greetings! I'm getting the following when I submit a form which has "compounded" checkbox fields checked that are generated by parameterized traits (if I leave then unchecked everything else works great)
Caught exception in Site::Controller::Node->add "Cannot delegate clear_errors to clear_errors because the value of result is not defined at /usr/local/lib/perl/5.10.1/Moose/Meta/Method/Delegation.pm line 99
HTML::FormHandler::Field::clear_errors('HTML::FormHandler::Field::Checkbox::8=HASH(0xbb9d2c8)') called at /usr/local/share/perl/5.10.1/HTML/FormHandler/Validate.pm line 54
HTML::FormHandler::Validate::validate_field('HTML::FormHandler::Field::Checkbox::8=HASH(0xbb9d2c8)') called at /usr/local/share/perl/5.10.1/HTML/FormHandler/Fields.pm line 100
HTML::FormHandler::Fields::_fields_validate('HTML::FormHandler::Field::Compound::4=HASH(0xbba08a0)') called at /usr/local/share/perl/5.10.1/HTML/FormHandler/Validate.pm line 73
HTML::FormHandler::Validate::validate_field('HTML::FormHandler::Field::Compound::4=HASH(0xbba08a0)') called at /usr/local/share/perl/5.10.1/HTML/FormHandler/Fields.pm line 100
HTML::FormHandler::Fields::_fields_validate('HTML::FormHandler::Field::Compound::4=HASH(0xbb9d298)') called at /usr/local/share/perl/5.10.1/HTML/FormHandler/Validate.pm line 73
HTML::FormHandler::Validate::validate_field('HTML::FormHandler::Field::Compound::4=HASH(0xbb9d298)') called at /usr/local/share/perl/5.10.1/HTML/FormHandler/Fields.pm line 100
HTML::FormHandler::Fields::_fields_validate('Site::Form::Node::Edit::10=HASH(0xbac8210)') called at /usr/local/share/perl/5.10.1/HTML/FormHandler.pm line 312
Result objects are built from three different sources: the object (item
or init_object), input (params), or fields. You're doing a hybrid in
which most of the form's fields come from the object, but you add a few
extra (the parameterized 'permission fields'). Since you're updating
those separately, I assume that they're not found in your item. The code
that creates the tree of results is supposed to create results from the
fields, if there are no accessors for the field names in your 'item'. So
something is probably breaking down there... *Are* there accessors in
your DBIC result source that match those field names? If there are, you
could change the field names so they don't match, if that's confusing
things.
You don't have to provide an item; you can provide a schema and
'item_class' instead. That's one thing to try. (All forms that inherit
from the DBIC model have a 'schema' attribute so you don't need to add
another one with 'db_schema' ).
If you can provide a testcase that I can use to step through the code
I'll take a look at it.
Gerda