[html-formfu] Still missing some parts of the picture in HTML::FormFu::Model::DBIC

Alex Povolotsky tarkhil at over.ru
Sat Mar 13 17:20:40 GMT 2010


Hello!

I'm still missing some essential parts of DBIx interaction.

I have two simple tables

CREATE TABLE country (id serial primary key, name varchar(128) not null);
CREATE TABLE location (name varchar(128) primary key, country_id int not 
null references country(id));

Models are OK.

Form is rather trivial

---
model_config:
   resultset: Location
elements:

   - type: Text
     name: name
     label: Name

   - type: ComboBox
     empty_first: 1
     empty_first_label: -select-
     label: Country
     name: country_id
     model_config:
        resultset: Country
        label_column: name

   - type: Submit
     name: submit

Form displays OK, reading data from Country correctly.

If I'm entering country name in combobox text field, it yields in two errors

1. New country row is not inserted at all
2. Instead of new id, new country name is inserted, of course, dying 
with error.

What am I doing wrong, again?

I promise to write down a FAQ on HTML::FormFu::Model::DBIC after 
finishing a work.

Alex.




More information about the HTML-FormFu mailing list