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

As lame as it gets... 1

Status
Not open for further replies.

TruthInSatire

Programmer
Aug 12, 2002
2,964
US
I've done this 100,000 times before but now it doesn't want to work.

I'm trying to submit a form using a hyperlink vice a submit button

//function
I've also tried the name of the form, that didn't work either.
Code:
<SCRIPT language="JavaScript">
function submitform()
{
  document.forms[0].submit();
}
</SCRIPT>

// form tag
Code:
<form name = "formName" method = "post" action = "pageName.htm">

// hyperlink
Code:
<a href="javascript: submitform()" class="btn">

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
I'm sorry, I should know better.

"object doesn't support this property or method"

is the error

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Some things to check:

1. If you have any form element named "submit", change the name. It would be causing this issue.

2. Is your form really the first form on the page?

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
excellent display!

Yes I had a hidden form field named submit for some checks on the server side. I changed the name. The error changed to "object expected" so I changed forms[0] to the form's name and it works. The form is the ONLY form on the document.

Thank you!

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top