Skip to content

Commit

Permalink
add cookbook recipe for accessing DB item for other fields default value
Browse files Browse the repository at this point in the history
  • Loading branch information
davewood committed Sep 4, 2012
1 parent 0dde88b commit 6cf088b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/HTML/FormHandler/Manual/Cookbook.pod
Expand Up @@ -358,6 +358,17 @@ set in the update_model method;
$self->next::method;
}

If you need to access a database field in order to create the value for a
form field you can use a C< default_* > method.

sub default_myformfield {
my ($self, $field, $item) = @_;
return unless defined $item;
my $databasefield = $item->databasefield;
my $value = ... # do stuff
return $value;
}

=head2 Additional changes to the database

If you want to do additional database updates besides the ones that FormHandler
Expand Down

0 comments on commit 6cf088b

Please sign in to comment.