[html-formfu] Updating 2 tables
Octavian Rasnita
orasnita at gmail.com
Sun Feb 14 05:50:32 GMT 2010
Hi,
I have 2 dependent tables with the following structure:
create table communique(
id int unsigned not null auto_increment primary key,
last_modified timestamp not null default current_timestamp,
type varchar(255) not null default ""
) engine=InnoDB default charset=utf8;
create table aga(
id int unsigned not null auto_increment primary key,
communique int unsigned not null,
detail text,
unique index(communique),
constraint foreign key(communique) references communique(id) on delete
cascade
) engine=InnoDB default charset=utf8;
And I want to use Catalyst::Controller::HTML::FormFu to update both tables.
I have created the following form:
<model_config>
resultset Communique
</model_config>
<elements>
name last_modified
type DateTime
label Last modified:
</elements>
<elements>
name type
type Text
label Type:
</elements>
<elements>
name agas.detail
type Textarea
label Details:
</elements>
There is a relation named "agas" between communique and aga tables and I was
hoping that by using agas.detail, it would get/set the value from that
field, however unfortunately HTML::FormFu doesn't have this feature
(although it would be great).
It gave the following error on form rendering:
"Caught exception in Fu::Controller::Com->add "element names may not contain
periods or square brackets
see documentation on nested_names() for details"
I have searched for documentation about "nested_names" but I couldn't find
anything.
Maybe HTML::FormFu doesn't support multiple table updates by just using a
config file, but I hope there is a more elegant way of doing these updates
than getting the values from the form and making the DBIC updates manually.
Does anyone know if nested_names() and the other related methods can help me
to update more tables from a single form?
Thank you for any information regarding this.
Octavian
More information about the HTML-FormFu
mailing list