From: Moritz Bunkus Date: Wed, 13 Mar 2013 16:49:02 +0000 (+0100) Subject: L: neue Funktion ajax_submit_tag() X-Git-Tag: release-3.1.0beta1~518 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=86a76ea5ef69b72b777298ca2335e980a216f377;p=kivitendo-erp.git L: neue Funktion ajax_submit_tag() --- diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index b6021f5c2..1ffe22d0e 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -185,6 +185,16 @@ sub button_tag { return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick); } +sub ajax_submit_tag { + my ($self, $url, $form_selector, $text, @slurp) = @_; + + $url = _J($url); + $form_selector = _J($form_selector); + my $onclick = qq|submit_ajax_form('${url}', '${form_selector}')|; + + return $self->button_tag($onclick, $text, @slurp); +} + sub yes_no_tag { my ($self, $name, $value) = splice @_, 0, 3; my %attributes = _hashify(@_); @@ -577,6 +587,14 @@ be added via the C 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 'input type="button"' tag with a very specific onclick +handler that submits the form given by the jQuery selector +C<$form_selector> to the URL C<$url> (the actual JavaScript function +called for that is C in C). The +button's label will be C<$text>. + =item C Creates a HTML 'input type="button"' tag with an onclick handler