473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

submit form data in multiple buttons on a html form

The problem is I have 3 buttons that need to submit the form to different
URL.
My approach is to declare <input type="submit"> rather than <input
type="button">.
And put the following in the javascript:
InputForm.action="URL LOCATION"
InputForm.method="POST";

I think we don't need InputForm.submit(); because <input type="submit">.

Please advise and comment my approaches. Thanks!!

==============================================
<html>
<head>
<script type="text/javascript">
function onClickURL1()
{ InputForm.action="url1.asp"
InputForm.method="POST";
//InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL2()
{ InputForm.action="url2.asp"
InputForm.method="POST";
//InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL3()
{ InputForm.action="url3.asp"
InputForm.method="POST";
//InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
}
</script>
</head>
<body>
<form name="InputForm">
<P><input type="text" name="username">
<P><INPUT type="submit" value="submit form data to URL1" name="action1"
onclick="onClickURL1()">
<P><INPUT type="submit" value="submit form data to URL2" name="action2"
onclick="onClickURL2()">
<P><INPUT type="submit" value="submit form data to URL3" name="action3"
onclick="onClickURL3()">
</form>
</body>
</html>
Jul 23 '05 #1
1 2754
Matt wrote:
The problem is I have 3 buttons that need to submit the form to different
URL.
Use 3 forms with different "action" attribute values. Use CSS to
format them display:inline to prevent the "form" element from creating
a paragraph.
My approach is to declare <input type="submit"> rather than <input
type="button">.
That is not a declaration of anything at all.
And put the following in the javascript:
InputForm.action="URL LOCATION"
InputForm.method="POST";
This is proprietary referencing. Use document.forms["InputForm"]...
instead.
I think we don't need InputForm.submit(); because <input type="submit">.

Please advise and comment my approaches. Thanks!!

==============================================
<html>
This document lacks a DOCTYPE declaration prior to the root element and
is thus not Valid HTML. See <http://validator.w3.org/> for details.
<head>
<script type="text/javascript">
function onClickURL1()
{ InputForm.action="url1.asp"
InputForm.method="POST";
//InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
}
Have you ever thought about users without client-side scripting support?
[...]
<form name="InputForm">
<P><input type="text" name="username">
<P><INPUT type="submit" value="submit form data to URL1" name="action1"
onclick="onClickURL1()">


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
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicolas Keller | last post by:
Hi! I'm used to have Mozilla for testing my PHP sites when I'm coding. The site's nearly finished, now I've made a test with the Internet Exlporer... guess what... failed. The problem: I'm...
2
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the...
3
by: John Dunlop | last post by:
(Note crosspost and follow-ups to ciwah.) Nicolas Keller wrote in thread "Differences in form handling btw Mozilla and IE?": > The problem: I'm using a form that submit's (POST) its data via...
2
by: ivanhoe | last post by:
All articles and tutorials I've seen on subject of forms say that if there's name and value for submit button(input tag with type="submit"), they'll get submitted along with the rest of the...
15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
3
by: Adam | last post by:
Hey guys, I've decided to stop banging my head against the wall and just ask you guys for the answer. I can't seem to find it. I have a form in which I have multiple submit buttons; only, I'm...
3
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: ...
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
8
by: Willie | last post by:
Hi All; I have a form with multiple buttons and I would like to disable the buttons after the user clicks on the button to prevent multiple submitions. <input type="submit" name="return1"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.