Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! Validation only working in IE, not NSx?

Status
Not open for further replies.

pcorchary

MIS
Feb 23, 2002
60
US
I wrote a form-based web CGI in Perl and needed some field validation. So I picked this up from the web since I've never written any JS.

It sez it's supposed to work in IE and NS, but it only works in IE 5x (win/mac) and IE6 (win). It fails silently on all versions of NS4x and 6x that I've tried!

Here's a sample routine:
function validRequired(formField,fieldLabel)
{
var result = true;

if (formField.value == "")
{
alert('Please enter a value for the "' + fieldLabel +'" field.');
formField.focus();
result = false;
}

return result;
}

function validateForm(theForm)
{
if (!validRequired(theForm.fullname,"Name"))
return false;

if (!validNum(theForm.yearsexperience,"Years Experience",true))
return false;

return true;
}


called as onsubmit="return validateForm(this)"

Anyone have any ideas?

My needs are pretty simple really. I have certain required fields, and some others that need to be numeric only ...

TIA. philc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top