here is the code
package AddressBook::Controller::Address; use strict; use warnings; use base qw(Catalyst::Controller::FormBuilder Catalyst::Controller::Bi +ndLex); use Data::Dumper; sub edit : Local Form { my ($self, $c, $address_id, $person_id) = @_; my $address : Stashed; print $c->request->arguments->[0]; print "\n"; print Dumper(" address_id is: ".Dumper($address_id)); print Dumper("person_id is: ".Dumper($person_id)); my $persid = $c->model('AddressDB::Addresses')->find({person => $id}); my $person = $c->model('AddressDB::People')->find({id => $persid}); if ($self->formbuilder->submitted && $self->formbuilder->validate){ # transfer data from form to database $address->location($self->formbuilder->field('location')); $address->postal ($self->formbuilder->field('postal' )); $address->phone ($self->formbuilder->field('phone')); $address->email ($self->formbuilder->field('email')); $address->insert_or_update; $c->stash->{message} = ($address_id > 0 ? 'Updated ' : 'Added new ').'address for '. $ +address->person->name; $c->detach('list'); } else { # transfer data from database to form if(!$address_id){ $c->stash->{message} = 'Adding a new address '; } else { $c->stash->{message} = 'Updating an address '; } $c->stash->{message} .= ' for '. $address->person->name; $self->formbuilder->field(name => 'location', value => $address +->location); $self->formbuilder->field(name => 'postal', value => $address-> +postal); $self->formbuilder->field(name => 'phone', value => $address->p +hone); $self->formbuilder->field(name => 'email', value => $address->e +mail); } }
thanks

In reply to Re^2: Can't call method "find" on an undefined value by Anonymous Monk
in thread Can't call method "find" on an undefined value by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.