[Jifty-commit] r2449 - in jifty/branches/template-declare: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Jan 1 23:59:07 EST 2007
Author: jesse
Date: Mon Jan 1 23:59:07 2007
New Revision: 2449
Modified:
jifty/branches/template-declare/ (props changed)
jifty/branches/template-declare/lib/Jifty/Web/Form.pm
Log:
r46650 at pinglin: jesse | 2007-01-01 23:52:38 -0500
* Refactoring Jifty::Web::Form to let you set a target and an action
Modified: jifty/branches/template-declare/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Web/Form.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Web/Form.pm Mon Jan 1 23:59:07 2007
@@ -5,7 +5,7 @@
use base qw/Jifty::Object Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(qw(actions printed_actions name call is_open disable_autocomplete));
+__PACKAGE__->mk_accessors(qw(actions printed_actions name call is_open disable_autocomplete target submit_to));
=head2 new ARGS
@@ -39,6 +39,8 @@
my %args = (
name => undef,
call => undef,
+ submit_to => undef,
+ target => undef,
disable_autocomplete => undef,
@_,
);
@@ -70,6 +72,8 @@
my $self = shift;
my %args = (name => undef,
call => undef,
+ target => undef,
+ submit_to => $ENV{PATH_INFO},
disable_autocomplete => undef,
@_);
@@ -77,6 +81,7 @@
$self->printed_actions( {} ) ;
$self->name($args{name});
$self->call($args{call});
+ $self->target($args{target});
$self->disable_autocomplete($args{disable_autocomplete});
}
@@ -184,8 +189,9 @@
}
}
- my $form_start = qq!<form method="post" action="! . Jifty->web->escape( $ENV{PATH_INFO} ) . qq!"!;
+ my $form_start = qq!<form method="post" action="! . Jifty->web->escape( $self->submit_to) . qq!"!;
$form_start .= qq! name="@{[ $self->name ]}"! if defined $self->name;
+ $form_start .= qq! target="@{[ $self->target ]}"! if defined $self->target;
$form_start .= qq! autocomplete="off"! if defined $self->disable_autocomplete;
$form_start .= qq! enctype="multipart/form-data" >\n!;
Jifty->web->out($form_start);
More information about the Jifty-commit
mailing list