[thelist] Submitting a form with javascript

Jeff Howden jeff at jeffhowden.com
Tue Nov 4 02:38:00 CST 2003


john,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: John Corry [mailto:lists at neoncowboy.com]
>
> > then he's left with a link that no longer does what he
> > expects.
>
> And a submit button that does exactly what he expects,
> and an enter key that also submits the form.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

sure, but once a ui element is there and he becomes accustomed to it, it'll
be catastrophic (to him) when it stops working.  if doesn't become
catastrophic then i'd question the need for the link.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > any reason you can't just move the <form> and </form>
> > tags in order to encompass this optional link?
>
> Yes, well...not 'can't', but there are reasons it's
> difficult and impractical.
>
> All of the pages in the site, including the admin
> section, are generated by php. Common page elements
> (navigation, header, footer) are returned by php
> functions (which work similarly to includes). I'm
> afraid that conditionally writing the <form> tag on the
> page where it will be used (which is what will be
> required to place it outside of the main content <td>)
> would just make the code difficult to read and
> understand.
>
> It's a lot cleaner to keep the <form> tag where there's
> a form.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

it'd be less messy than writing some conditional code to determine whether
or not to show the link?

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > this is avoidable though.  don't use the submit()
> > method.  instead, call a click() event on the submit
> > button when the link is clicked.
>
> Wait...what?
> I can do:
> Document.formName.submitInputButtonName.click() ? And
> that acts the same as the submit button being clicked?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

yes, except it's "document", not "Document".

personally, i'd still question the need for the link though.

.jeff

------------------------------------------------------
Jeff Howden - Web Application Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/



More information about the thelist mailing list