Permalink
Browse files

add cookbook recipe for accessing DB item for other fields default value

  • Loading branch information...
David Schmidt
David Schmidt committed Sep 4, 2012
1 parent 0dde88b commit 6cf088b62444f7f880ff492813542ac2eb18b75d
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 6cf088b

Please sign in to comment.