mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Fix adding too small/big number to input for decimals for number repo column type
This commit is contained in:
parent
a472eda699
commit
0f67ce78c0
2 changed files with 11 additions and 2 deletions
|
@ -196,6 +196,14 @@ function filesSizeValidator(ev, fileInputs, fileTypeEnum) {
|
||||||
return filesSizeValid;
|
return filesSizeValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function numberMinMaxValidator(value, min, max) {
|
||||||
|
if(parseInt(value) < min || isNaN(value))
|
||||||
|
return min;
|
||||||
|
else if(parseInt(value) > max)
|
||||||
|
return max;
|
||||||
|
else return value;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Overriden in billing module for checking whether enough
|
* Overriden in billing module for checking whether enough
|
||||||
* team space is free.
|
* team space is free.
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
<%= t('libraries.manange_modal_column.number_type.decimals_label') %>
|
<%= t('libraries.manange_modal_column.number_type.decimals_label') %>
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<%= number_field_tag('decimals', selected_decimals, in: 0...Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS,
|
<%= number_field_tag('decimals', selected_decimals, between: 0...Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS,
|
||||||
class: 'form-control') %>
|
class: 'form-control',
|
||||||
|
oninput: "this.value = numberMinMaxValidator(this.value, 0, #{Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS})" ) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue