[Javascript] Generic submit

Alan Gardner gardner.alan at gmail.com
Fri Jan 7 15:41:19 CST 2005


I thought it looked good, but my javascript console says "Error:
this.form has no properties". I've checked and the link is inside the
form tag. Suggestions?


On Fri, 07 Jan 2005 15:58:51 -0500 (EST), Shawn Milo
<ShawnMilo at runbox.com> wrote:
> Something like document.forms[0].submit(); should work, but,
> of course, it would only submit the first form.
> 
> Also, maybe -- wait!
> 
> Try this:
> document.forms[this.form.id].submit();
> 
> If your XHTML is good, and you have ids for all of
> your forms, I think that this should work.
> 
> Shawn.
> 
> > Hi all,
> > If I want to use an anchor link to submit a form, but may not know the
> > name of the form, or how many forms are on the page, how would I best
> > do that?  I initially thought a simple <a href="#"
> > onclick="this.form.submit()"> would work, but it  appears only to work
> > on an input tag.  Any suggestions on how to create a generic submit
> > link that I can throw into any page without additional scripting?
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>



More information about the Javascript mailing list