| re: submit form data in multiple buttons on a html form
Matt wrote:[color=blue]
> The problem is I have 3 buttons that need to submit the form to different
> URL.[/color]
Use 3 forms with different "action" attribute values. Use CSS to
format them display:inline to prevent the "form" element from creating
a paragraph.
[color=blue]
> My approach is to declare <input type="submit"> rather than <input
> type="button">.[/color]
That is not a declaration of anything at all.
[color=blue]
> And put the following in the javascript:
> InputForm.action="URL LOCATION"
> InputForm.method="POST";[/color]
This is proprietary referencing. Use document.forms["InputForm"]...
instead.
[color=blue]
> I think we don't need InputForm.submit(); because <input type="submit">.
>
> Please advise and comment my approaches. Thanks!!
>
> ==============================================
> <html>[/color]
This document lacks a DOCTYPE declaration prior to the root element and
is thus not Valid HTML. See <http://validator.w3.org/> for details.
[color=blue]
> <head>
> <script type="text/javascript">
> function onClickURL1()
> { InputForm.action="url1.asp"
> InputForm.method="POST";
> //InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
> }[/color]
Have you ever thought about users without client-side scripting support?
[color=blue]
> [...]
> <form name="InputForm">
> <P><input type="text" name="username">
> <P><INPUT type="submit" value="submit form data to URL1" name="action1"
> onclick="onClickURL1()">[/color]
Timing issues are likely to cause this to fail. Use either
type="button" instead or, much better, do not use client-side
scripting at all.
PointedEars |