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() doesn't work?

Status
Not open for further replies.

XgrinderX

Programmer
Mar 27, 2001
225
US
Why would the following code:
Code:
<table border=0 cellspacing=0 cellpadding=5 width=100%>
<tr>
	<form method="post" action="[URL unfurl="true"]https://www.landata-cc.com/UCC/processpayment.asp"[/URL] name="frmSubmitPay">
	<input type=hidden name=transNumb value="200412130007">
	<input type=hidden name=returnPath value="gen3XML.asp">
	<input type=hidden name=userName value="glowery">
	<input type=hidden name=iUserID value="207">
	<input type=hidden name=amount value="26.5">
	<input type=hidden name=iSiteID value="1">
	<td align=right width=100%>
		<a href="javascript:document.frmSubmitPay.submit();" target="_parent"><font size=2>Submit & Pay &gt;&gt;</font></a>
	</td>
	</form>
</tr>
</table>

produce the following error:

Error: 'document.frmSubmitPay' is null or not an object

when I click on the Submit & Pay link? This is driving me nuts because it doesn't seem to make sense to me!! What am I overlooking here?

-Greg
 
perhaps you have more than one element with the same name? Try renaming it and see if it works.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Unfortunately, I tried that already to no avail. I renamed the form to frmPayNow and changed the link to document.frmPayNow.submit() and I get the same error with the changed name.

I also tried moving the form code so that it is within an actual cell and that did not make a difference either. I am really stumped here.

-Greg
 
Try:

Code:
<form name="frmSubmitPay" ... target="_parent">
...
<a href="#" onclick="document.forms['frmSubmitPay'].submit(); return false;">Submit & Pay &gt;&gt;</a>
...

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Greg -

Are you creating the form dynamically via server-side code? If you create more than one form, make sure to alter the name for each subsequent form.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top