function check48(n) { if ("" === n) {return true;} return n >= 48; } function check6(n) { if ("" === n) {return true;} // use the modulus operator '%' to see if there is a remainder if (n % 6 != 0) { alert('Order by half-dozen increments greater than 48'); return false; } return true; } // Attach your form's onsubmit handler var f = document.getElementById('erb'); f.onsubmit = function() { var el = document.getElementById('WHT'); return (check6(el.value) && check48(el.value)); }