To mix metaphores, I’ve jumped into the deep end here, with AJAX, before I’ve ever done much at all with Javascript. Now, I’m trying to do a simple, obvious, rank-beginner thing and it just doesn’t work! Here’s the very simple code:
function checkSubmit(theForm) {
var myForm = document.getElementById(theForm);
if(myForm.sbName.value == '') {
alert('Need to enter a name!');
return false;
} else if(myForm.sbMessage.value == '') {
alert('Need to enter a message!');
return false;
} else {
document.myForm.submit();
}
}
It’s called on the onClick event of a button element. The form has the same ID and name values. The input value checks work perfectly, but the submit just doesn’t work! I fiddle with it, and get one of two errors: document.myForm has no properties, or: document.the SpecificFormName.submit is not a function. I’ve tried it as document.forms.theForm... document.forms.theSpecificFormName... every permutation I can think of, and it’ either the "no properties" or "not a function" error.
I’ve been three days reading I-don’t-know-how-many tutorials and sample scripts, and they all say the same thing, and at least I THINK I’m doing the same thing. Any ideas