diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 6eba6f468..1a6db209f 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -12,6 +12,7 @@ - Bugfix [ 1055396 ] Template switching issue (Len Kranendonk) - WebGUI Operations are now dynamically loaded (Len Kranendonk) - Added button to Form.pm / HTMLForm.pm (Len Kranendonk) + - Added a "Cancel" button to each tab form (Len Kranendonk) 6.2.7 - Expanded upon the help for URL extensions. diff --git a/lib/WebGUI/TabForm.pm b/lib/WebGUI/TabForm.pm index 2fd806d19..a990655e4 100644 --- a/lib/WebGUI/TabForm.pm +++ b/lib/WebGUI/TabForm.pm @@ -151,14 +151,18 @@ A string containing the link to the tab-CascadingStyleSheet =cut sub new { - my ($class, $tabs, $css); + my ($cancel, $class, $tabs, $css); $class = $_[0]; $tabs = $_[1]; $css = $_[2] || $session{config}{extrasURL}.'/tabs/tabs.css'; foreach my $key (keys %{$tabs}) { $tabs->{$key}{form} = WebGUI::HTMLForm->new; } - bless { _submit=>WebGUI::Form::submit(), _form=>WebGUI::Form::formHeader(), _hidden=>"", _tab=>$tabs, _css=>$css }, $class; + $cancel = WebGUI::Form::button({ + value=>WebGUI::International::get('cancel'), + extras=>q|onClick="location.href='|.WebGUI::URL::page().q|'"| + }); + bless { _cancel=>$cancel, _submit=>WebGUI::Form::submit(), _form=>WebGUI::Form::formHeader(), _hidden=>"", _tab=>$tabs, _css=>$css }, $class; } @@ -191,7 +195,7 @@ sub print { $form .= ''; $i++; } - $output .= '
'.$tabs.$_[0]->{_submit}.'
'; + $output .= '
'.$tabs.$_[0]->{_submit}."  ".$_[0]->{_cancel}.'
'; $output .= $form; $output .= WebGUI::Form::formFooter(); $output .= ''; diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index aa00abfc4..2e12a3175 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -7467,6 +7467,12 @@ config file.

lastUpdated =>1092930637, context => q|help body forum post preview template| }, + 'cancel' => { + message => q|cancel|, + lastUpdated =>1092930637, + context => q|Label of the cancel button| + }, + }; 1;