Hello!

I have two tables, for a bare mininmum,

create table jail(jid serial primary key, name varchar not null);
create table hosting_domain(domid serial primary key, name varchar not null, jailid int not null references jail(jid));

DBIx::Class::Schema::Loader gives me

__PACKAGE__->belongs_to("jailid", "Hosting::Schema::Result::Jail", { jid => "jailid" });

for HostingDomain.pm and

__PACKAGE__->has_many(
  "hosting_domains",
  "Hosting::Schema::Result::HostingDomain",
  { "foreign.jailid" => "self.jid" },
);

for Jail.pm

which seems quite logical.

However, when I try to make a form for domain creation with jail selection

---
model_config:
  resultset: HostingDomain

elements:
  - type: Text
    name: name
    label: Domain name
    constraints:
      - Required

  - type: Select
    nested: jailid
    model_config:
      resultset: Jail

  - type: Submit
    label: Submit

I'm getting an error

Caught exception in Hosting::Controller::Domain->add "cannot set nested at /usr/local/lib/perl5/site_perl/5.10.1/HTML/FormFu/ObjectUtil.pm line 362 at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Controller/HTML/FormFu/Action/FormConfig.pm line 42 at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Controller/HTML/FormFu/Action/FormConfig.pm line 42"

Reading manual and examples, I've found nothing usable in my case.

How do I make a proper Select control, to display jail name and select jail id? Second question, how do I add '- Select -' entry to control, without any value, to be shown in first place?

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