mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
bugfixes for primary input validation
This commit is contained in:
parent
92581335a1
commit
5cc88b26c4
1 changed files with 4 additions and 0 deletions
4
main.js
4
main.js
|
@ -220,6 +220,7 @@ $(document).ready(function () {
|
||||||
if (element.prop('min')) {
|
if (element.prop('min')) {
|
||||||
if (val < min) {
|
if (val < min) {
|
||||||
element.val(min);
|
element.val(min);
|
||||||
|
val = min;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,18 +228,21 @@ $(document).ready(function () {
|
||||||
if (element.prop('max')) {
|
if (element.prop('max')) {
|
||||||
if (val > max) {
|
if (val > max) {
|
||||||
element.val(max);
|
element.val(max);
|
||||||
|
val = max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if entered value is illegal use previous value instead
|
// if entered value is illegal use previous value instead
|
||||||
if (isNaN(val)) {
|
if (isNaN(val)) {
|
||||||
element.val(element.data('previousValue'));
|
element.val(element.data('previousValue'));
|
||||||
|
val = element.data('previousValue');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if step is not set or step is int and value is float use previous value instead
|
// if step is not set or step is int and value is float use previous value instead
|
||||||
if (isNaN(step) || step % 1 === 0) {
|
if (isNaN(step) || step % 1 === 0) {
|
||||||
if (val % 1 !== 0) {
|
if (val % 1 !== 0) {
|
||||||
element.val(element.data('previousValue'));
|
element.val(element.data('previousValue'));
|
||||||
|
val = element.data('previousValue');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue