|
Lines 881-887
Link Here
|
| 881 |
<label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label> |
881 |
<label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label> |
| 882 |
[% IF (sql_param.select_multiple) %] |
882 |
[% IF (sql_param.select_multiple) %] |
| 883 |
<select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]" multiple> |
883 |
<select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]" multiple> |
| 884 |
<option value="%" hidden></option> |
884 |
<option value="[% sql_param.input.values.join("\n") | html %]" hidden></option> |
| 885 |
[% ELSE %] |
885 |
[% ELSE %] |
| 886 |
<select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]"> |
886 |
<select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]"> |
| 887 |
[% END %] |
887 |
[% END %] |
|
Lines 1582-1588
Link Here
|
| 1582 |
// if the report param form has multiselects override default form submission |
1582 |
// if the report param form has multiselects override default form submission |
| 1583 |
if( $('#report_param_form').find('select[multiple]').length ) { |
1583 |
if( $('#report_param_form').find('select[multiple]').length ) { |
| 1584 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
1584 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
| 1585 |
$(this).prepend('<option hidden></option>'); |
|
|
| 1586 |
$(this).on('change', function() { |
1585 |
$(this).on('change', function() { |
| 1587 |
var $selected = $(this).val().join('\n'); |
1586 |
var $selected = $(this).val().join('\n'); |
| 1588 |
$(this).find('option:first').val($selected); |
1587 |
$(this).find('option:first').val($selected); |
|
Lines 1591-1610
Link Here
|
| 1591 |
|
1590 |
|
| 1592 |
$('#report_param_form').on('submit', function(e) { |
1591 |
$('#report_param_form').on('submit', function(e) { |
| 1593 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
1592 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
| 1594 |
if( $(this).find('option:selected').length ) { |
1593 |
if( $(this).find('option:selected').length != 1 ) { |
| 1595 |
var $selected = $('option:first', this).val(); |
|
|
| 1596 |
$(this).val($selected); |
| 1597 |
} |
| 1598 |
else { |
| 1599 |
let values = $.map( $(this).find('option'), function(o) { |
| 1600 |
return $(o).val(); |
| 1601 |
}).slice(1).join('\n'); |
| 1602 |
$(this).find('option:first').val(values).prop('selected', true); |
| 1603 |
} |
| 1604 |
if( $(this).find('option:selected').length === 0 ) { |
| 1605 |
$(this).val(['%']); |
| 1606 |
} |
| 1607 |
else if( $(this).find('option:selected').length > 1 ) { |
| 1608 |
var $selected = $('option:first', this).val(); |
1594 |
var $selected = $('option:first', this).val(); |
| 1609 |
$(this).val($selected); |
1595 |
$(this).val($selected); |
| 1610 |
} |
1596 |
} |
| 1611 |
- |
|
|