Permalink
Browse files

Merge pull request #36 from davewood/master

cookbook recipe for accessing db field for other fields default value
  • Loading branch information...
2 parents 089f610 + 6cf088b commit 35f4643a74ef46267d19bd8439cde6eb1a8db8c4 @gshank committed Oct 10, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/HTML/FormHandler/Manual/Cookbook.pod
@@ -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

0 comments on commit 35f4643

Please sign in to comment.