Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1ccc89c8

Von Bernd Bleßmann vor fast 7 Jahren hinzugefügt

  • ID 1ccc89c81f95c77ec583c973dec38b56177c81ab
  • Vorgänger b92bc207
  • Nachfolger 00402ae6

calculate_qty (Formel): Input- und Formel-Feld auch als Dom-Id übergeben können

Unterschiede anzeigen:

bin/mozilla/io.pl
my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2;
$column_data{qty} = $cgi->textfield(-name => "qty_$i", -size => 5, -class => "numeric", -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec));
$column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i', 'formel_$i')", -value => $locale->text('*/'))
$column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i', '', 'formel_$i')", -value => $locale->text('*/'))
. $cgi->hidden(-name => "formel_$i", -value => $form->{"formel_$i"})
if $form->{"formel_$i"};
js/calculate_qty.js
function calculate_qty_selection_window(input_name, formel) {
function calculate_qty_selection_window(input_name, input_id, formel_name, formel_id) {
var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes";
var action = "calculate_qty";
if (formel_id) {
var formel = $('#' + formel_id).val();
} else {
var formel = $('[name="' + formel_name + '"]').val();
}
url = "common.pl?" +
"INPUT_ENCODING=UTF-8&" +
"action=" + action + "&" +
"input_name=" + encodeURIComponent(input_name) + "&" +
"formel=" + encodeURIComponent(document.getElementsByName(formel)[0].value)
"input_id=" + encodeURIComponent(input_id) + "&" +
"formel=" + encodeURIComponent(formel);
//alert(url);
window.open(url, "_new_generic", parm);
}
templates/webpages/generic/calculate_qty.html
<form name="Form">
<input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
<input type="hidden" name="input_id" value="[% HTML.escape(input_id) %]">
<table width="100%">
<tr><td>[% 'Please insert object dimensions below.' | $T8 %]</td></tr>
......
[%- END %]
var result = [% formel %];
result = number_format(result, 2, '[% MYCONFIG.numberformat %]');
window.opener.document.getElementsByName(document.Form.input_name.value)[0].value = result;
if (document.Form.input_id.value) {
window.opener.document.getElementById(document.Form.input_id.value).value = result;
} else {
window.opener.document.getElementsByName(document.Form.input_name.value)[0].value = result;
}
self.close();
}

Auch abrufbar als: Unified diff