473,782 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

one form two buttons(well three)

Hi all

Was wondering if someone could show me how I can use javascript to submit a
form using three separate buttons that would cause the forms action="" to
hold different values?
Poko
Oct 23 '05 #1
2 1609
"Poko" <po**@shaw.ca > wrote in message
news:q4U6f.2829 12$tl2.154376@p d7tw3no...
Hi all

Was wondering if someone could show me how I can use javascript to submit a form using three separate buttons that would cause the forms action="" to
hold different values?
Poko


Will this help? Watch for word-wrap.

<html>
<head>
<title>3actions .htm</title>
<script type="text/javascript">
function submits(what) {
document.form1. action += "?" + what;
document.form1. submit();
}
</script>
</head>
<body>
<form action="3action s.htm" method="post" name="form1">
<input type="button" value="1" onclick="submit s(1)">
<input type="button" value="2" onclick="submit s(2)">
<input type="button" value="3" onclick="submit s(3)">
</form>
</body>
</html>
Oct 23 '05 #2
McKirahan wrote on 24 okt 2005 in comp.lang.javas cript:
"Poko" <po**@shaw.ca > wrote in message
news:q4U6f.2829 12$tl2.154376@p d7tw3no...
Hi all

Was wondering if someone could show me how I can use javascript to
submit

a
form using three separate buttons that would cause the forms
action="" to hold different values?
Poko


Will this help? Watch for word-wrap.

<html>
<head>
<title>3actions .htm</title>
<script type="text/javascript">
function submits(what) {
document.form1. action += "?" + what;
document.form1. submit();
}
</script>
</head>
<body>
<form action="3action s.htm" method="post" name="form1">
<input type="button" value="1" onclick="submit s(1)">
<input type="button" value="2" onclick="submit s(2)">
<input type="button" value="3" onclick="submit s(3)">
</form>
</body>
</html>


No javascript needed, use the [default] 'Get' method:

<form action="3action s.htm" method="get">
<input type="submit" value="do1" name="theAction ">
<input type="submit" value="do2" name="theAction ">
<input type="submit" value="do3" name="theAction ">
</form>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #3

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

Similar topics

1
6261
by: Jeremy Langworthy | last post by:
Hi I have a dynamicly generated form (well the elements are at least) that looks something like this: while( not end of returned records): <input name="plan_id" type="checkbox" id="" value="<?= $row_plans->planid ?>">
8
7158
by: L Major | last post by:
Hi Unfortunately, I am limited to using tables for part of my current project. I have a form that spans across a number of TR and TD in the shape of checkboxes. Doctype is XHTML 1.0 Transitional, Encoding is utf-8 Is there anything wrong? Should I try something else? What in that case?
1
1378
by: Brian | last post by:
I'm thinking of creating a contact form where the user can either send their message immediately or preview the message first. So far, I cannot think of a way to make it happen. My form mail processing script -- NMS' TFmail -- requires a config file to be set in the form, normally by a hidden field. I could move that to the submit "send" button, and have a different config file set in a submit "preview" button, but there's no way to...
2
1348
by: Jean | last post by:
I have two form and I want to display in the first form some of the info from the second one. Here is how I tried to do it: <<<<ok button of form2>>>>> Dim Myform1 As New Form1 Myform1.Label1.Text = TextBox1.Text 'label1 is in the first form well, it seems very simple but my program does not want to update the information of the first form. I guess I'm doing something wrong but what ??
5
6134
by: D Witherspoon | last post by:
I use the following code to open up a form. ------------------------------------------------------- If fImage Is Nothing Then fImage = New frmImage End If fImage.Show()
1
1078
by: crawlerxp | last post by:
Does anyone know what is the problem here: I have installed IIS and asp.net 1.1 on windows XP SP1. asp.net 1.1 is a production not development version I downloaded from ms site. Welll this is the problem: I have copied files from my localhost to the server and tried to access the form. Well, when I open the form, it shows only 2 labels without 2 buttons and 2
3
1346
by: stacey | last post by:
Hi all, I have a quick question about form classes. I am following this tutorial: http://www.evolt.org/article/PHP_Login_System_with_Admin_Features/17/60384/index.html Basically, it is a login system. There is a session.php and a process.php that is called when validating a login. The problem I am having, is on my login form I fill out the fields and then the <form> calls process.php. In process.php, the $form->num_errors is being set...
4
1329
by: celoftis | last post by:
I've got html page with has a fixed height - there are five buttons on the page. The page has a fixed, known height - but the width can change. The five buttons should be arranged on the page as follows (all buttons should always be 3px from the top): "button1" - left edge always 3px from left side of the page "button2" - left edge always be 5px to the left of "button 1:" "button3" - buttons three and four should float (relatively) in...
1
2477
by: tash.robinson | last post by:
I have a modal form called like: myKeyboard.ShowDialog(Me) If myKeyboard.DialogResult = Windows.Forms.DialogResult.OK Then result = myKeyboard.txtEntry.Text Else result = defaulttext End If
0
9639
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
10311
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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
9942
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
8967
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...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.