From: Moritz Bunkus Date: Wed, 13 Mar 2013 14:29:50 +0000 (+0100) Subject: L.button_tag: Support für 'confirm' & Doku X-Git-Tag: release-3.1.0beta1~522 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=341fbe8b28d2b9cb98934aed0336a99923cfefc0;p=kivitendo-erp.git L.button_tag: Support für 'confirm' & Doku --- diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 0bdef40f9..b6021f5c2 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -180,6 +180,8 @@ sub button_tag { $attributes{id} ||= $self->name_to_id($attributes{name}) if $attributes{name}; $attributes{type} ||= 'button'; + $onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm}; + return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick); } @@ -572,9 +574,20 @@ tag's C defaults to C. If C<$attributes{confirm}> is set then a JavaScript popup dialog will be added via the C handler asking the question given with -C<$attributes{confirm}>. If request is only submitted if the user +C<$attributes{confirm}>. The request is only submitted if the user clicks the dialog's ok/yes button. +=item C + +Creates a HTML 'input type="button"' tag with an onclick handler +C<$onclick> and a value of C<$text>. The button does not have a name +nor an ID by default. + +If C<$attributes{confirm}> is set then a JavaScript popup dialog will +be prepended to the C<$onclick> handler asking the question given with +C<$attributes{confirm}>. The request is only submitted if the user +clicks the dialog's "ok/yes" button. + =item C Creates a HTML 'textarea' tag named C<$name> with the content