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

Carl Franks fireartist at gmail.com
Thu Mar 17 15:28:50 GMT 2011


On 16 March 2011 20:49, Nigel Metheringham <nigel at dotdot.it> wrote:
> 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...

Sorry you've been having such problems! Lets see if we can help at all...

> 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

What do you mean "ensured the form stash was loaded"?
Was is failing under FormConfig because your plugin was expecting data
in the form stash that wasn't there yet?

> 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!

If you let us know what state is being maintained, I can probably fix it.
However, I generally write FormFu plugins where necessary, as
process() can sometimes be quite expensive, so I'd rather never call
it twice.
I would also not rule out there being bugs in Model::HashRef, as there
doesn't appear to be a great number of tests for it.

> 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

Ah, this is being caused by an older installation of HTML-FormFu being
picked up by HTML::FormFu::Preload.
I've updated Makefile.PL to handle this better - suggesting the user
deletes the older dist files before continuing.

Carl



More information about the HTML-FormFu mailing list