[Catalyst-commits] r10625 -
trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/Controller
zby at dev.catalyst.perl.org
zby at dev.catalyst.perl.org
Tue Jun 23 19:54:29 GMT 2009
Author: zby
Date: 2009-06-23 19:54:29 +0000 (Tue, 23 Jun 2009)
New Revision: 10625
Modified:
trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/Controller/InstantCRUD.pm
Log:
value for submit button
Modified: trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/Controller/InstantCRUD.pm
===================================================================
--- trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/Controller/InstantCRUD.pm 2009-06-23 19:54:24 UTC (rev 10624)
+++ trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/Controller/InstantCRUD.pm 2009-06-23 19:54:29 UTC (rev 10625)
@@ -81,19 +81,26 @@
my $form_name = ref( $self ) . '::' . $self->source_name . 'Form';
my @ids;
@ids = ( item_id => [ @pks ] ) if @pks;
- my $processor = $form_name->new(
+ my $form = $form_name->new(
schema => $self->model_schema($c),
# item_class => $self->source_name($c),
method => $c->req->method,
params => $c->req->params,
@ids,
);
- if( $processor->process() ){
- my $item = $processor->item;
+ if( $form->process() ){
+ my $item = $form->item;
$c->res->redirect( $c->uri_for( 'view', $item->id ) );
$c->stash( item => $item );
}
- $c->stash( form => $processor->render );
+ if( @pks ){
+ $form->field( 'submit' )->value( 'Update' );
+ }
+ else{
+ $form->field( 'submit' )->value( 'Create' );
+ }
+
+ $c->stash( form => $form->render );
}
sub view : Local {
More information about the Catalyst-commits
mailing list