[thelist] Submitting a form with javascript

Jeff Howden jeff at jeffhowden.com
Mon Nov 3 16:19:45 CST 2003


john,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: John Corry [mailto:lists at neoncowboy.com]
>
> The form is for a flower farmer to update the list of
> available flowers/varieties/colors.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

excellent.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> The flower farmer (NS 7/Win XP) is the only person using
> the form.
>
> He can see. He can hear. He has JavaScript turned on.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

until he reads an article about this evil thing called javascript and all
its security problems and follows the instructions on how to disable it.
then he's left with a link that no longer does what he expects.  highly
doubtful he'll equate his action with that reaction.  instead, he'll come to
you asking why it's stopped working.  you *might* have the foresight to ask
if javascript is enabled at which point you should hope he remembers he
disabled it.  if not, have fun.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> The form is pretty long. I want to put an *optional*
> link elsewhere on the page from whence he can submit
> the form. There's a button too..but just one, at the
> bottom of the form.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

any reason you can't just move the <form> and </form> tags in order to
encompass this optional link?

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> I don't need the onSubmit event.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

no, but when you do.  time to re-engineer.

this is avoidable though.  don't use the submit() method.  instead, call a
click() event on the submit button when the link is clicked.  now, no more
problems with browsers and the submit() method and the onsubmit event
handler will be there for you user later should you need it.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> As far as I know, a submit button can only be in the
> form that is being submitted. That won't work, I need
> it in a whole different part of the page.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

and is that part of the page wrapped in another form?  if not, see above
about moving the <form> or </form> tags to accommodate.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> Of course you're right .jeff, and maybe I won't do it
> this way, maybe I'll just sprinkle submit buttons
> throughout the form...but in the context I'm working in,
> using a link with submit() just is not that out of line.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

you just brought up a good point though.  if this "submit" link is somewhere
else entirely on the page, then does it have any context with the form it's
submitting?  perhaps not.  making it a link and not a submit button takes it
even more out of context.  sure, it's for a single user so you can chalk it
up to user training, but that's the sort of design decision that comes back
to haunt you.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> You'll notice that my original post did not say:
> 'Help, I need to be educated on the best way to balance
> accessibility and to know the best way to submit my
> form'
>
> I don't care about the dogma, I can figure that out on
> my own. Thanks.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

you can call it dogma if you like, but there's plenty of evidence to back up
what i'm talking about.

however, you get what you pay for.  you asked for help and i countered with
alternatives and why i thought they were better.  you're free to do it
whatever way you want, but you're going to have a difficult time
legitimizing your current solution on thelist.  if it works for you, fine,
but i really don't want people to get the idea it's ok to use all over the
place.

.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