redefine a submit button in terms of a normal button

in short: override new() instead of toHtml to allow changes to be made
to the submit button.
This commit is contained in:
Doug Bell 2011-04-11 16:42:20 -05:00
parent 744568108f
commit 0c25620867

View file

@ -49,18 +49,23 @@ sub getName {
return WebGUI::International->new($session, 'WebGUI')->get('submit');
}
#-------------------------------------------------------------------
#----------------------------------------------------------------------------
=head2 toHtml ( )
=head2 new ( session, properties )
Renders a button.
Preconfigure this button to be a Submit button
=cut
sub toHtml {
my $self = shift;
$self->{_params}{extras} ||= 'class="forwardButton" onclick="this.value=\''.$i18n->get(452).'\'"';
return $self->SUPER::toHtml;
sub new {
my ( $class, @args ) = @_;
my $self = $class->SUPER::new( @args );
$self->set( 'type' => 'submit' );
if ( !$self->get('extras') ) {
my $i18n = WebGUI::International->new($self->session, 'WebGUI');
$self->set( 'extras' => 'class="forwardButton" onclick="this.value\'' . $i18n->get(452) . '\'"' );
}
return $self;
}
1;