Fix: broken feature and add FIXME
This commit is contained in:
parent
1aa26d0cd7
commit
c6d008fb1b
@ -65,42 +65,43 @@ class FormActions
|
|||||||
'100' => $langs->trans("ActionDoneShort")
|
'100' => $langs->trans("ActionDoneShort")
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
print "\n";
|
print "\n";
|
||||||
print "<script type=\"text/javascript\">
|
print "<script type=\"text/javascript\">
|
||||||
var htmlname = '".$htmlname."';
|
var htmlname = '".$htmlname."';
|
||||||
|
|
||||||
jQuery(document).ready(function () {
|
$(document).ready(function () {
|
||||||
jQuery('#select'+htmlname).change(function() {
|
select_status();
|
||||||
select_status();
|
|
||||||
});
|
|
||||||
jQuery('#val'+htmlname).change(function() {
|
|
||||||
select_status();
|
|
||||||
});
|
|
||||||
|
|
||||||
select_status();
|
$('#select' + htmlname).change(function() {
|
||||||
|
select_status();
|
||||||
|
});
|
||||||
|
// FIXME use another method for update combobox
|
||||||
|
//$('#val' + htmlname).change(function() {
|
||||||
|
//select_status();
|
||||||
|
//});
|
||||||
});
|
});
|
||||||
|
|
||||||
function select_status() {
|
function select_status() {
|
||||||
mypercentage = jQuery('#val'+htmlname).val();
|
var selected = $('#select' + htmlname).val();
|
||||||
jQuery('input[name=percentageshown]').val((mypercentage>=0?mypercentage:''));
|
var percentage = $('input[name=percentage]');
|
||||||
jQuery('input[name=percentage]').val(mypercentage);
|
percentage.val((selected>=0?selected:''));
|
||||||
if (mypercentage == -1) {
|
if (selected == -1) {
|
||||||
jQuery('input[name=percentageshown]').attr('disabled', 'disabled');
|
percentage.attr('disabled', 'disabled');
|
||||||
jQuery('.hideifna').hide();
|
$('.hideifna').hide();
|
||||||
}
|
}
|
||||||
else if (mypercentage == 0) {
|
else if (selected == 0) {
|
||||||
jQuery('input[name=percentageshown]').attr('disabled', 'disabled');
|
percentage.attr('disabled', 'disabled');
|
||||||
jQuery('.hideifna').show();
|
$('.hideifna').show();
|
||||||
}
|
}
|
||||||
else if (mypercentage == 100) {
|
else if (selected == 100) {
|
||||||
jQuery('input[name=percentageshown]').attr('disabled', 'disabled');
|
percentage.attr('disabled', 'disabled');
|
||||||
jQuery('.hideifna').show();
|
$('.hideifna').show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
jQuery('input[name=percentageshown]').removeAttr('disabled');
|
percentage.removeAttr('disabled');
|
||||||
jQuery('.hideifna').show();
|
$('.hideifna').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>\n";
|
</script>\n";
|
||||||
@ -111,9 +112,9 @@ class FormActions
|
|||||||
}
|
}
|
||||||
print '</select>';
|
print '</select>';
|
||||||
if ($selected == 0 || $selected == 100) $canedit=0;
|
if ($selected == 0 || $selected == 100) $canedit=0;
|
||||||
print ' <input type="text" id="val'.$htmlname.'" name="percentageshown" class="flat hideifna" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit&&($selected>=0)?'':' disabled="disabled"').'>';
|
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat hideifna" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit&&($selected>=0)?'':' disabled="disabled"').'>';
|
||||||
print '<span class="hideifna">%</span>';
|
print '<span class="hideifna">%</span>';
|
||||||
print ' <input type="hidden" name="percentage" value="'.$selected.'">';
|
//print ' <input type="hidden" name="percentage" value="'.$selected.'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user