[html-formfu] Repeatable displays every row in table (bug?)
Greg Coates
greg at coatesoft.com
Mon May 11 22:00:41 GMT 2009
This fixed the problem, but it brings up another issue. From the
DBIx::Class::Resultset documentation:
| Note: find_or_new is probably not what you want when creating a
| new row in a table that uses primary keys supplied by the
| database. Passing in a primary key column with a value of undef
| will cause "find" to attempt to search for a row with a value of
| NULL.
That's exactly what's happening to me, and it causes the insert that
follows to fail.
I'm not sure where to go with this. Write a test that fails?
Somethings else?
Greg
Greg Coates wrote:
> Yep, that solved it for me too.
>
> Greg
>
>
> Ascii King wrote:
>> I had this same problem back in this thread
>> http://lists.scsys.co.uk/pipermail/html-formfu/2009-March/001884.html
>>
>> the answer was how I was calling the new record. I eeded to use
>> find_or_new to call a new record.
>> my $book = $c->model('DB::MyTable')->find_or_new({ id => $id });
>>
>> Mario Minati wrote:
>
>>>> OK. Let me try again, then.
>>>>
>>>> I have a form that is used to display invoices from a table called
>>>> 'invoices'. It contains a Repeatable that is used to display the
>>>> individual lines for those invoices. These lines come from a table
>>>> called 'invoice_items'.
>>>>
>>>> When the form is used on an existing record, all is well. However,
>>>> when
>>>> I use the form to create a new record, I have a problem. Instead of
>>>> the
>>>> Repeatable being blank, every row from the 'invoice_items' table is
>>>> displayed.
>>>>
>>>> Greg
>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
More information about the HTML-FormFu
mailing list