Skip Menu |

This queue is for tickets about the HTML-FormFu CPAN distribution.

Report information
The Basics
Id: 54967
Status: resolved
Priority: 0/
Queue: HTML-FormFu

People
Owner: Nobody in particular
Requestors: maz [...] mlx.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: blocks with nested_name set and no Input fields
Date: Thu, 25 Feb 2010 16:30:10 +0800
To: bug-HTML-FormFu [...] rt.cpan.org, bug-HTML-FormFu-Model-DBIC [...] rc.cpan.org
From: John Maslanik <maz [...] mlx.net>
If you have a block with nested_name set and all of the elements are set to type "Label", this causes the blocks nested_name to appear in the "valid" list of fields. This appears to happen because since there are no input fields under the nested_name, no hash is created. (see FormFu.pm line 662) This behavior causes HTML::FormFu::Model::DBIC to do strange things because when you call its update function, it will run through the list of valid names setting DBIx::Class's fields to the values. (DBIC.pm line 847) HTML::FormFu::Model::DBIC ends up calling the relationship accessor, which is set to the nested name with a undef value because the nested_name was a Block (DBIC.pm line 852). I spend over a day chasing this bug. My problem was that when I called update on HTML::FormFu::Model::DBIC, a query was being executed similar to the following. UPDATE table SET primary_key='' WHERE primary_key=1. I put debugging code through out FormFu.pm and DBIC.pm to see where my primary key was getting unset, it turns out it was getting unset when DBIC.pm was calling the relationship accessor with an undef value. It seems to me to be a but in both HTML::FormFu and HTML::FormFu::Model::DBIC. HTML::FormFu should not be adding "Block" elements to the list of "valid" fields. HTML::FormFu::Model::DBIC should not be trying to set DBIC fields for blocks and/or blocks with nested_name set. HTML::FormFu::Model::DBIC checks for relationships when looping through fields from "get_fields", but does not check when looping through "valid" fields. HTML::FormFu version: 0.06001 HTML::FormFu::Model::DBIC version: 0.06000 Below is the config portion that was causing the problem. <elements> type Block nested_name payment name payment <elements> type Label name status </elements> <elements> type Label name payment_date </elements> </elements> Thanks, John Maslanik
This is now fixed in svn, and will be in the next cpan release. Thanks, Carl