<!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 &lt;a href=.....&gt;</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.&nbsp; 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>&lt;input type=button name=myURL</FONT>
<BR><FONT SIZE=2>onClick=submitMe(this.name, this.form)&gt;</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>&nbsp; form.action=action;</FONT>
<BR><FONT SIZE=2>&nbsp; form.submit();</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>This works fine when it's attached to a button.&nbsp; 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.&nbsp; 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.&nbsp; 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>&lt;a</FONT>
<BR><FONT SIZE=2>href=&quot;javascript:onClick=addVoucher(Default.ASP?WCI=VoucherDisplay&amp;WCE=Add,</FONT>
<BR><FONT SIZE=2>this.form)&quot;&gt;Vouchers&lt;/a&gt;</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.&nbsp; I'm trying to hard code the form</FONT>
<BR><FONT SIZE=2>by using the document object.</FONT>
<BR><FONT SIZE=2>&lt;a</FONT>
<BR><FONT SIZE=2>href=&quot;javascript:onClick=addVoucher(Default.ASP?WCI=VoucherDisplay&amp;WCE=Add,</FONT>
<BR><FONT SIZE=2>document.frmDisplay)&quot;&gt;Vouchers&lt;/a&gt;</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>