[html-formfu] Getting knotted with FormFu :-)

Nigel Metheringham nigel at dotdot.it
Wed Mar 16 20:49:04 GMT 2011


This post has got to be a bit of a long running soap opera... sorry -
I am trying to keep the items within it focused...


I am attempting to produce some relatively complex forms within a 
catalyst application (Catalyst, DBIx::Class, HTML::FormFu etc
are all current CPAN versions running on a recently built 5.12.3
perl).

The form involves a set of cross db table sets that I cannot directly
model with DBIC/FormFu, so I decided to try using a 
HTML::FormFu::Model::HashRef model - transforming the dataset into/from
a hashref from/to the db.

Problem 1:
  Populating the options into a set of Selects (would have been done
  in a DBIC model_config if it was a straight DBIC/FormFu combination).
  There just isn't a straight analogue of this using the HashRef model.

However, I do have for other purposes, a FormFu plugin that populates
Selection options from the form stash.  That works fine normally...
but in this configuration would not work, unless I removed the FormConfig
attribute from the catalyst controller and manually got the form object,
loaded the config file etc, then ensured the form stash was loaded, then
did $form->process.  Just adding additional $form->process state to the
normal controller did not have that effect

So

Problem 2:
  FormFu is saving internal state that is not updated by a $form->process
  stage.  You need to defer process until all setup has been done, which
  breaks some of the Catalyst::Controller::HTML::FormFu workflow
  Strangely using ::Model::DBIC seems to cause some internal state to
  be updated, and doing the same operations then works!


Theres a number of other hacks I tried (pasting additional fields into 
a part built form to add a variable number of select fields), which
discovered that the insert_after/insert_before methods also suffer from
state being saved within the form and only work on a flat form.

I was going to build a more formal set of bug reports against the current
dev version on github, but I can't make that build properly. 
Actually a further look shows that its just spewing warnings on t/01use.t
but those distract from the fact that the tests pass.  I'll see if I get 
the same effects on the github version...

	Nigel.

The test warnings are:-

t/01use.t ...................................................... 1/3 Couldn't require HTML::FormFu::Element::_Field : "get_error" is not exported by the HTML::FormFu::ObjectUtil module
 "_require_constraint" is not exported by the HTML::FormFu::ObjectUtil module
 "set_nested_hash_value" is not exported by the HTML::FormFu::ObjectUtil module
 "nested_hash_key_exists" is not exported by the HTML::FormFu::ObjectUtil module
 "get_nested_hash_value" is not exported by the HTML::FormFu::ObjectUtil module
Can't continue after import errors at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Element/_Field.pm line 9
BEGIN failed--compilation aborted at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Element/_Field.pm line 13.
Compilation failed in require at (eval 2027) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Element::_Group : Attempt to reload HTML/FormFu/Element/_Field.pm aborted.
Compilation failed in require at (eval 2030) line 2.
	...propagated at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/base.pm line 94.
BEGIN failed--compilation aborted at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Element/_Group.pm line 4.
Compilation failed in require at (eval 2029) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Element::_Input : Attempt to reload HTML/FormFu/Element/_Field.pm aborted.
Compilation failed in require at (eval 2032) line 2.
	...propagated at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/base.pm line 94.
BEGIN failed--compilation aborted at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Element/_Input.pm line 4.
Compilation failed in require at (eval 2031) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Element::_NonBlock : Can't locate object method "mk_item_accessors" via package "HTML::FormFu::Element::_NonBlock" at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Element/_NonBlock.pm line 10.
Compilation failed in require at (eval 2039) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Element::RequestToken : Can't locate object method "mk_item_accessors" via package "HTML::FormFu::Element::RequestToken" at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Element/RequestToken.pm line 11.
Compilation failed in require at (eval 2062) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Constraint::_others : Can't locate object method "mk_item_accessors" via package "HTML::FormFu::Constraint::_others" at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Constraint/_others.pm line 15.
Compilation failed in require at (eval 2105) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Constraint::DBIC::Unique : Can't locate object method "mk_accessors" via package "HTML::FormFu::Constraint::DBIC::Unique" at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Constraint/DBIC/Unique.pm line 9.
Compilation failed in require at (eval 2135) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Filter::_Compound : Can't locate object method "mk_accessors" via package "HTML::FormFu::Filter::_Compound" at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Filter/_Compound.pm line 6.
Compilation failed in require at (eval 2188) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28
Couldn't require HTML::FormFu::Plugin::RequestToken : Can't locate object method "mk_item_accessors" via package "HTML::FormFu::Plugin::RequestToken" at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/HTML/FormFu/Plugin/RequestToken.pm line 6.
Compilation failed in require at (eval 2232) line 2.
 at /Users/nigel/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/Module/Pluggable.pm line 28





--
[ Nigel Metheringham ------------------------------ nigel at dotdot.it ]
[                 Ellipsis Intangible Technologies                  ]





More information about the HTML-FormFu mailing list