The parens suggestion didn't fix the problem, but it *did* lead me to a solution so THANKS!! FWIW, here is what I wound up using: function fleet_size_check(form) { ctrl = form.fleet_size; myRe=/^[0-9]{1,5}/; ctrlMax = 10000 if ((!myRe.test(ctrl.value)) || (ctrl > ctrlMax)) { alert("Please enter a valid fleet size (integer between 1 and 10000)."); document.profile_info.fleet_size.focus(); return (true); } else return (false); } Thanks for the help! - - - Jeanne >From: David Baskin <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: CF-Talk <[EMAIL PROTECTED]> >Subject: RE: (yet another) Javascript Question >Date: Fri, 02 Mar 2001 11:22:38 -0800 > >Jeanne, it looks like you don't have and "(" ")" around your second if >case. >i think that will fix your problem. > > else if (ctrl.value > 10000) { > alert("Please enter a valid fleet size."); > >david > >-----Original Message----- >From: Jeanne Sarfaty Glazer [mailto:[EMAIL PROTECTED]] >Sent: Friday, March 02, 2001 11:10 AM >To: CF-Talk >Subject: (yet another) Javascript Question > > >Hi Folks, >If there's a more appropriate place to ask this question, please let me >know >- this list is so incredibly high volume,I'd hate to be erroneously >contributing to it when I should send my question elsewhere. > >With that said: > >I'm doing Javascript validation and having trouble getting the following to >work (it is supposed to only allow user to enter an integer between 1 and >10000): > >function fleet_size_check(form) { > > ctrl = form.fleet_size; > myRe=/^[0-9]{1,6}/; > > if (!myRe.test(ctrl.value)) { > alert("Please enter a valid fleet size."); > document.profile_info.fleet_size.focus(); > return (true); > } > else if ctrl.value > 10000 { > alert("Please enter a valid fleet size."); > document.profile_info.fleet_size.focus(); > return (true); > } > else return (false); >} > >The first "if" seems to work OK, but not the second. Any suggestions would >be most appreciated. > >TIA, >- - - Jeanne > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists