Lines 15-31
Link Here
|
15 |
|
15 |
|
16 |
function validate() { |
16 |
function validate() { |
17 |
var error = false; |
17 |
var error = false; |
18 |
if (parseInt(document.getElementById("from-input").value) < 1) { |
18 |
var from_input = document.getElementById("from-input").value; |
|
|
19 |
var to_input = document.getElementById("to-input").value; |
20 |
|
21 |
if (isNaN(parseInt(from_input))) { |
22 |
document.getElementById("from-error").innerHTML = " *Must be a positive integer"; |
23 |
error = true; |
24 |
} else if (parseInt(from_input) < 1) { |
19 |
document.getElementById("from-error").innerHTML = " *Cannot be smaller than 1"; |
25 |
document.getElementById("from-error").innerHTML = " *Cannot be smaller than 1"; |
20 |
error = true; |
26 |
error = true; |
21 |
} else { |
27 |
} else { |
22 |
document.getElementById("from-error").innerHTML = ""; |
28 |
document.getElementById("from-error").innerHTML = ""; |
23 |
} |
29 |
} |
24 |
if (parseInt(document.getElementById("from-input").value) > parseInt(document.getElementById("to-input").value)) { |
30 |
|
|
|
31 |
if (isNaN(parseInt(to_input))) { |
32 |
document.getElementById("to-error").innerHTML = " *Must be a positive integer"; |
33 |
error = true; |
34 |
} else if (parseInt(from_input) > parseInt(to_input)) { |
25 |
document.getElementById("to-error").innerHTML = " *Cannot be smaller than starting value"; |
35 |
document.getElementById("to-error").innerHTML = " *Cannot be smaller than starting value"; |
26 |
error = true; |
36 |
error = true; |
27 |
} |
37 |
} else { |
28 |
else { |
|
|
29 |
document.getElementById("to-error").innerHTML = ""; |
38 |
document.getElementById("to-error").innerHTML = ""; |
30 |
} |
39 |
} |
31 |
|
40 |
|
32 |
- |
|
|