View Full Version : form validation

May 12th, 2003, 10:44 PM
I am trying to use 2 javascripts (onclick with yaromat validation and an onblur for numbers only) to validate a form but it keeps getting a little yellow error triangle at the bottom left of my screen. the form can be viewed at http://www.thedigitalarchitects.com/clients/HTCC/chtskktest2.cfm but the backend is not linked up. any suggestions would be greatly appreciated.

Roy Sinclair
May 12th, 2003, 11:14 PM
In the IE menu: Tools > Internet Options > Advanced , turn on the checkbox labeled "Display a notification for every script error". Then you'll see the problem that causes the little icon to be displayed instead of just the little icon. You can also just click on the little icon to get the message but if you're developing pages it's much better to be informed quickly instead of having to notice the tiny little icon turning on.

Better yet, install the Mozilla browser and use it's Javascript console to get more informative and useful error messages.

BTW, the error you haven't seen is on line 79 char 1, document.checknum.TotalHours is null or not an object.

May 12th, 2003, 11:16 PM
In this function:

function checknumber(){
var x=document.checknum.TotalHours.value
var anum=/(^\d+$)|(^\d+\.\d+$)/
if (anum.test(x))
alert("Please input a valid number!")
return (testresult)


var x=document.checknum.TotalHours.value

Needs to be this:

var x=document.form1.TotalHours.value