473,657 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.actio n="URL LOCATION"
InputForm.metho d="POST";

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

Please advise and comment my approaches. Thanks!!

=============== =============== =============== =
<html>
<head>
<script type="text/javascript">
function onClickURL1()
{ InputForm.actio n="url1.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL2()
{ InputForm.actio n="url2.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL3()
{ InputForm.actio n="url3.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //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="onClic kURL1()">
<P><INPUT type="submit" value="submit form data to URL2" name="action2"
onclick="onClic kURL2()">
<P><INPUT type="submit" value="submit form data to URL3" name="action3"
onclick="onClic kURL3()">
</form>
</body>
</html>
Jul 23 '05 #1
1 2782
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.actio n="URL LOCATION"
InputForm.metho d="POST";
This is proprietary referencing. Use document.forms["InputForm"]...
instead.
I think we don't need InputForm.submi t(); 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.or g/> for details.
<head>
<script type="text/javascript">
function onClickURL1()
{ InputForm.actio n="url1.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //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="onClic kURL1()">


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
6584
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 using a form that submit's (POST) its data via three different image buttons (depending on which button you click, something different should happen):
2
1862
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 JavaScript: InputForm.action="URL LOCATION" InputForm.method="POST"; I think we don't need InputForm.submit(); because <input type="submit">.
3
4341
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 three > different image buttons (depending on which button you click, > something different should happen): > > <form action="id.php" method="post" name="form2">
2
9586
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 form... but I've just noticed (after debugging my perl script for quite a while :/ ) that it is true only when user clicks on submit, and if form is submitted via hitting enter you don't get name=value for submit buttton...
15
6566
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 the buttons. The problem is when I post a form to itself, the Enter key will not submit the form, it only clears the contents of the text box. The only way I can submit is to click the submit button. Here is a simplified version of my code that I...
3
10142
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 using button tags, not input tags to do it. It seems that IE6 is treating all the button elements as being successful on submit. This is, to say the least, surprising since the Spec is pretty clear that it should.
3
2559
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: http://www.drpt.virginia.gov/temp1.gif All the fields on this form have validation controls on them so they can not submit the form unless all fields are completed and some fall within a specified numeric range. When the form first is loaded,...
5
20010
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 separate Submit buttons. In basic HTML, I can have multiple forms on a page and the browser knows that if any of the fields for Form A have the focus, then pressing ENTER will send a Click to the submit button for Form A. Same for Form B, etc. ...
8
12091
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" value="Send To MFG" id="return1" onClick='this.disabled=true;this.form.submit()' > This works but I do not get the return1 value passed to the action script as I do if I just have :
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8502
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.