Hello, happy new year everybody.
I have an object "Account". I save into it a DATETIME field into my database. But in my form I have 2 fields : one for the date and an other for the time. So I create a DateTime object ( http://search.cpan.org/~drolsky/DateTime-0.4501/lib/DateTime.pm ) from this 2 fields and save it into the database. But to edit this object when I used $form->model->default_values($contactmsg); the entire result (Date and Time) is loaded into my datemsg object. So I need to split this field into 2 field and load it by default into the edit form. Actually I do like that : sub editmsg : Local FormConfig('person/addmsg.yml') { my ( $self, $c, $id_msg, $id_person ) = @_; $c->stash->{template} = 'person/addmsg.tt2'; $id_person =~ /\d+/ or die 'invalid id'; my $contactmsg = $c->stash->{contactmsg} = $c->model('DB::Contactmsg')->find($id_msg) or die "Contactmsg $id_msg not found"; my $form = $c->stash->{form}; if ( $form->submitted_and_valid ) { $form->save_to_model($contactmsg); $c->response->redirect( $c->uri_for("/person/view/$id_person#tab1") ); $c->detach; } elsif ( !$form->submitted ) { $form->model->default_values($contactmsg); } } Please, how can I do to load by default my value and split it into my field "datemsg" and "timemsg" ? $form->model->default_values($contactmsg); load my entire object, but how can I do to overide one form field please ? Thanks, Antoine. _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu