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.


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to