[thelist] JS field validation ?

Bob Davis bobd at members.evolt.org
Tue Feb 20 12:54:39 CST 2001


Hi all, 

I'm having a little problem getting something to work.  I am trying to
determine whether a value entered into a form field is a number, and, if it
is, to call another function.

My validation function is:

function CheckRange(box)    {
    if    (isNaN(box.value))    {
        alert('You must enter a number')
        }    
    else { valChange() }
        
    }

and the form field looks like this:

<input type="text" onChange="CheckRange(this)" size=1 name="xaxis" value="0"
tabindex="1">

For some reason, if I enter a non-numeric value into the field, the alert
box does come up, but the valChange function is called.  It shouldn't be,
right?

Obviously, I've made a mistake somewhere.  I just don't know where it is.

Can anyone offer some advice?

TIA,
bob    

-- 

bob davis
bobd at members.evolt.org





More information about the thelist mailing list