Richards-san wrote:
> With JavaScript you can specify the form action, so you'd have
> something like:
>
> <form name="aForm" action="defaultAction.do" onSubmit="return
>checkSubmit(this);">
> <input type="submit" name="button1" value="use default action">
> <input type="submit" name="button2" value="use other action"
>onClick="document.aForm.action='otherAction.do';">
> </form>
I tried that in a web application a long time ago. Worked great with
Netscape, the action never changed in IE3. I'd gotten so fed up with
IE from that and other projects, that I avoid client-side scripting
as much as possible.
However, it shouldn't be hard to write an Action that will handle
forwarding the action. Something like:
<form name="aForm" action="dispatcherAction.do" onSubmit="return
checkSubmit(this);">
<input type="submit" name="SUBMIT_defaultAction.do" value="use default
action">
<input type="submit" name="SUBMIT_otherAction.do" value="use other action">
</form>
Then, have dispatcherAction look for which SUBMIT_xxx.do was sent,
take the suffix, and forward. There you have a general action
dispatcher for all your forms. Just don't name any fields other
than submit buttons to anything with a "SUBMIT_" prefix.
The only problem I can see with this is when one can hit enter instead
of a button. Oh, but can't that only happen when there is if ((one and
only one edit box) and (one and only one submit button))? Maybe it
is OK for all cases.
--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home: http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/