<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2652.35">
<TITLE>RE: [Javascript] submitting a form using anchor tags</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Please provide more code. What does the addVoucher() do? Also, AFAIK there is no this.form for <a href=.....></FONT>
</P>
<P><FONT SIZE=2>Bob Filipiak (Contractor)</FONT>
<BR><FONT SIZE=2>MCP </FONT>
</P>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: ryan tornberg [<A HREF="mailto:rtornberg@yahoo.com">mailto:rtornberg@yahoo.com</A>]</FONT>
<BR><FONT SIZE=2>Sent: Tuesday, May 08, 2001 2:05 PM</FONT>
<BR><FONT SIZE=2>To: javascript@LaTech.edu</FONT>
<BR><FONT SIZE=2>Subject: [Javascript] submitting a form using anchor tags</FONT>
</P>
<BR>
<P><FONT SIZE=2>I have multiple buttons on a form, so I declare them</FONT>
<BR><FONT SIZE=2>in HTML as type=button and name them as the form</FONT>
<BR><FONT SIZE=2>action. I then send the button name and form name to</FONT>
<BR><FONT SIZE=2>a js function to submit the form.</FONT>
</P>
<P><FONT SIZE=2>in HTML</FONT>
</P>
<P><FONT SIZE=2><input type=button name=myURL</FONT>
<BR><FONT SIZE=2>onClick=submitMe(this.name, this.form)></FONT>
</P>
<P><FONT SIZE=2>in javascript</FONT>
</P>
<P><FONT SIZE=2>function submitMe(action, form)</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2> form.action=action;</FONT>
<BR><FONT SIZE=2> form.submit();</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>
<P><FONT SIZE=2>This works fine when it's attached to a button. The</FONT>
<BR><FONT SIZE=2>action gets sent as a string and the form gets sent as</FONT>
<BR><FONT SIZE=2>an object. The problem is that when I try to use this</FONT>
<BR><FONT SIZE=2>exact same idea in an anchor tag, the form is</FONT>
<BR><FONT SIZE=2>undefined. Do you know how I can get around this?</FONT>
</P>
<P><FONT SIZE=2>The following will get to the function, but the form</FONT>
<BR><FONT SIZE=2>is undefined.</FONT>
<BR><FONT SIZE=2><a</FONT>
<BR><FONT SIZE=2>href="javascript:onClick=addVoucher(Default.ASP?WCI=VoucherDisplay&WCE=Add,</FONT>
<BR><FONT SIZE=2>this.form)">Vouchers</a></FONT>
</P>
<P><FONT SIZE=2>The following won't even get to the function because</FONT>
<BR><FONT SIZE=2>of a syntax error. I'm trying to hard code the form</FONT>
<BR><FONT SIZE=2>by using the document object.</FONT>
<BR><FONT SIZE=2><a</FONT>
<BR><FONT SIZE=2>href="javascript:onClick=addVoucher(Default.ASP?WCI=VoucherDisplay&WCE=Add,</FONT>
<BR><FONT SIZE=2>document.frmDisplay)">Vouchers</a></FONT>
</P>
<P><FONT SIZE=2>Any ideas?</FONT>
</P>
<BR>
<P><FONT SIZE=2>__________________________________________________</FONT>
<BR><FONT SIZE=2>Do You Yahoo!?</FONT>
<BR><FONT SIZE=2>Yahoo! Auctions - buy the things you want at great prices</FONT>
<BR><FONT SIZE=2><A HREF="http://auctions.yahoo.com/" TARGET="_blank">http://auctions.yahoo.com/</A></FONT>
</P>
<P><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>Javascript mailing list</FONT>
<BR><FONT SIZE=2>Javascript@LaTech.edu</FONT>
<BR><FONT SIZE=2><A HREF="http://www.LaTech.edu/mailman/listinfo/javascript" TARGET="_blank">http://www.LaTech.edu/mailman/listinfo/javascript</A></FONT>
</P>
</BODY>
</HTML>