Fix: edit of percentage

This commit is contained in:
Laurent Destailleur 2012-09-02 14:11:07 +02:00
parent b891975b7d
commit 1253683b83

View File

@ -49,7 +49,7 @@ class FormActions
* Show list of action status * Show list of action status
* *
* @param string $formname Name of form where select in included * @param string $formname Name of form where select in included
* @param string $selected Preselected value * @param string $selected Preselected value (-1..100)
* @param int $canedit 1=can edit, 0=read only * @param int $canedit 1=can edit, 0=read only
* @param string $htmlname Name of html prefix for html fields (selectX and valX) * @param string $htmlname Name of html prefix for html fields (selectX and valX)
* @return void * @return void
@ -96,15 +96,18 @@ class FormActions
$('.hideifna').hide(); $('.hideifna').hide();
} }
else if (defaultvalue == 0) { else if (defaultvalue == 0) {
percentage.attr('disabled', 'disabled'); percentage.val(0);
percentage.attr('disabled', 'disabled');
$('.hideifna').show(); $('.hideifna').show();
} }
else if (defaultvalue == 100) { else if (defaultvalue == 100) {
percentage.val(100);
percentage.attr('disabled', 'disabled'); percentage.attr('disabled', 'disabled');
$('.hideifna').show(); $('.hideifna').show();
} }
else { else {
percentage.removeAttr('disabled'); if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50) };
percentage.removeAttr('disabled');
$('.hideifna').show(); $('.hideifna').show();
} }
} }