[Bast-commits] r4041 - trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class
omega at dev.catalyst.perl.org
omega at dev.catalyst.perl.org
Fri Feb 8 08:37:36 GMT 2008
Author: omega
Date: 2008-02-08 08:37:36 +0000 (Fri, 08 Feb 2008)
New Revision: 4041
Modified:
trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm
Log:
Updated synopsis
Modified: trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm
===================================================================
--- trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm 2008-02-08 08:27:11 UTC (rev 4040)
+++ trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm 2008-02-08 08:37:36 UTC (rev 4041)
@@ -129,7 +129,23 @@
...
return $w;
}
-
+ sub preview : Local {
+ my ($self, $c) = @_;
+
+ my $item = $c->model('DBIC::Pet')->new();
+
+ # get the widget
+ my $w=$self->widget_pet($c);
+
+ # process the form parameters
+ my $result = $w->process($c->req);
+
+ $item->populate_with_widget($result);
+
+ # $item is now populated, but not "commited" to the database
+ # so you can now render it with a template or something
+
+ }
# this renders an edit form with values filled in from the DB
sub edit : Local {
my ($self,$c,$id)=@_;
@@ -163,7 +179,7 @@
# if there are no errors save the form values to the object
unless ($result->has_errors) {
- $item->populate_from_widget($result);
+ $item->update_from_widget($result);
$c->res->redirect('/users/pet/'.$id);
}
More information about the Bast-commits
mailing list