diff --git a/lib/WebGUI/Form/Submit.pm b/lib/WebGUI/Form/Submit.pm index ae0afc428..5dbff9da2 100644 --- a/lib/WebGUI/Form/Submit.pm +++ b/lib/WebGUI/Form/Submit.pm @@ -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;