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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.formname.submit(); stopped working 1

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
I can't for the life of me work out why my form has just stopped being submitted

I have a button with an on click which calls this function
Code:
function checkit(){

var msg = '';

if(document.guestgb.name.value == ''){msg = msg + '\nYour Name';}
if(document.guestgb.location.value == ''){msg = msg + '\nYour Location';}
if(document.guestgb.age.value == ''){msg = msg + '\nYour Age';}
if(document.guestgb.comments.value == ''){msg = msg + '\nYour Comments';}

if(msg != ''){
    alert("Please complete the following field(s),\n" + msg);
}
else{
    document.guestgb.submit();
}


}

but now I get an error
object doesn't support this property or method

what's changed? it used to work, and the alerts for failure to complete required fields works fine, I just can't submit the damn form - why?

i've even tried giving the form an ID and using get ElementById and still no joy.

Any ideas?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Thank you!!!!!

Talk about not being able to see the wood from the trees - lol

Code:
<img  name="submit" src="[URL unfurl="true"]http://www.stepnstomp.co.uk/images/submit1.png"[/URL] title="Submit Entry" alt="Submit Entry" onclick="checkit();" />



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top