[html-formfu] Having issues with nested repeatable loading from db.

Carl Franks fireartist at gmail.com
Fri Mar 6 15:51:07 GMT 2009


2009/3/6 Leanan Sidhe <the.leanan.sidhe at gmail.com>:
> I think the point was not to have the PK be non-hidden, but to just not
> require it be on the form at all.
>
> I'm not familiar with the code, but I imagine removing it entirely from the
> form would either
> a) make things more difficult
> b) make things impossible

B)

If you have related rows, FK 1, 3, 5
and in the time between loading the form and submitting it, someone
else adds a relationship to FK 2
you really don't want us to save that data to FK 1, 2, 3

> I do recommend though that there be some extra clarification for the
> documentation of HTML::FormFu::Model::DBIC to mention that the (countname? I
> forget the name of the field) needs to be set to the name that you want for
> your hidden count field, and that the table that you are repeating from's PK
> is in a hidden field as well.  (IE, these are *required*).  I never assume
> anything in an example is needed unless it is explicitly documented as such,
> and I saw no need to put my table's primary key in the form, since I wasn't
> using it.  I also had no need for a "count" of items, because I didn't care
> how many there were so long as they all displayed.  I've long since learned
> to try to stop wondering how the magic works and just accept that it works
> -- but when there are things that are required for the magic to work, they
> really should be explained more clearly.  I spent 3 days trying to figure
> this out.  Had I known those fields were required and necessary, I'd have
> had this form up and running 3 days ago.  Very frustrating, and I would
> hazard a guess that I am not the only one who has had issues with this lack
> of clarity.

And yet no doc patch attached, so what's going to get done about it?

I've easily spent 3 days out of the past 7 working on formfu, split
between responding to mailing list issues and working on
HTML-FormFu-Model-DBIC, including rewriting the docs from scratch. And
I'm still not finished.

I did just check the docs, and all 3 config examples under "has_many
and many_to_many relationships" include a hidden id field.
Only 1 of the examples included the hidden 'count' field, though the
docs for Element::Repeatable describe the hidden field matching
'counter_name' as "essential".
And all 13 config files in the test suite matching
    t/default_values/has_many_repeatable*.yml
    t/update/has_many_repeatable*.yml
include both hidden fields.

So it's not as if there were no hints at what to try.
A simple
    warn Dumper( $form->params );
would have highlighted a major issue, as most of the submitted values
would have been missing from the form.

I know the Model-DBIC docs are crap, but receiving a rather
non-constructive, moaning email, *while* I'm working on them, will
illicit a grouchy response such as this (be warned)!

Carl



More information about the HTML-FormFu mailing list