• Notice regarding image hosts and attachments. See here.

Schoolboy error?

~J~

~J~

Soldato
Joined
20 Oct 2003
Posts
7,558
Location
London
I'm doing something OBVIOUSLY wrong here, but for the life of me can't see what it is!

function validateForm() {
if (isEmpty(document.forms[0].txtName.value) == true)
{
alert("Please Tell us your name.");
document.forms[0].txtName.focus();
return (false);
}

<input id="txtName" type="text" name="txtName" />
<input id="Submit" type="button" value="submit" onclick="validateForm();" />

Won't bore you with the rest, the <input> tags are in a <form>, but just getting an "Object Expected" error when it hits the JavaScript!
 
Cheers Spunkey, trailing brace is actually there (my fault, sorry, didn't paste it), but honestly didn't know about the isEmpty not native!!

Will change accordingly!

Nathan: Yeah agree 100%, but it's only ever one form, just a dead easy capture page.
 
Back
Top Bottom