I want to check the number of user input. If it negative number it will disable the sumbit botton.
my code is run but let say i enter three -1 and if i change of it to positive the sumbit botton is enable. I want make sure if all the number positive before enable sumbit botton

here is code

if (x < 0 )
        {   
            if (document.getElementById('AX') && document.getElementById('XR') && document.getElementById('ZZ') < 0)
            {
                document.getElementById('cmdSubmit').disabled = true;
                alert('There is a problem! Cannot be negative number.');

                return false;
            }
            // If the script gets this far through all of your fields   
            // without problems, it's ok and you can submit the form
            else 
            {
                document.getElementById('cmdSubmit').disabled = false;

                return true;
            }
        }

document.getElementById('ZZ') is the element, not input value.

<input type="text" id="ZZ" value="test" />


document.getElementById('ZZ') is '<input type="text" id="ZZ" value="" />'

document.getElementById('ZZ').value is 'test'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.