From 86a76ea5ef69b72b777298ca2335e980a216f377 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 13 Mar 2013 17:49:02 +0100 Subject: [PATCH] L: neue Funktion ajax_submit_tag() --- SL/Template/Plugin/L.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- 2.20.1