473,516 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple buttons on a form

The ASP page has multiple buttons, and when the user clicks different
buttons, it will submit the form data to different URLs.

My first approach was to use BUTTON type, and triggers javascript function
to submit the form data. However, it didn't work properly and I changed to
use SUBMIT type.

<INPUT TYPE="BUTTON" NAME="action1" VALUE="Return to Main Search Page"
onClick="action1()">

function action1()
{ //etc...
document.myform.action = "main.asp"
document.myform.submit();
}

OR

<INPUT TYPE="SUBMIT" NAME="action1" VALUE="Return to Main Search Page"
onClick="action1()">

function action1()
{ //etc...
document.myform.action = "main.asp"
}

So which is the appropriate way? please advise. thanks!!
Jul 19 '05 #1
2 1838
PW

"Matt" <ma*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
The ASP page has multiple buttons, and when the user clicks different
buttons, it will submit the form data to different URLs.

When I need multiple buttons, I just have multiple forms as needed ...
<form ID="myform2" NAME="myform2" method="GET" action="tran_sale3.asp">
<button onclick="submit()" accesskey="P"
style="width:250px;height:50px;"><u>P</u>ROCEED</button>
</form>
<form ID="myform3" NAME="myform3" method="GET" action="tran_sale9.asp">
<button onclick="submit()" accesskey="C"
style="width:250px;height:50px;"><u>C</u>ANCEL</button>
</form>
Jul 19 '05 #2
CJM
Both the BUTTON and INPUT solutions will work, if you get your Javascript
right.

I tend to use <input type="submit"> because it has better browser support.

e.g. <input type="submit" name="submit1"
onclick="myform.action='main.asp';">

This is very similar to what you already have, so if there is still a
problem it will be with the Javascript syntax - in which case repost your
question to the .scripting.jscript NG.

hth

Chris

"Matt" <ma*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
The ASP page has multiple buttons, and when the user clicks different
buttons, it will submit the form data to different URLs.

My first approach was to use BUTTON type, and triggers javascript function
to submit the form data. However, it didn't work properly and I changed to
use SUBMIT type.

<INPUT TYPE="BUTTON" NAME="action1" VALUE="Return to Main Search Page"
onClick="action1()">

function action1()
{ //etc...
document.myform.action = "main.asp"
document.myform.submit();
}

OR

<INPUT TYPE="SUBMIT" NAME="action1" VALUE="Return to Main Search Page"
onClick="action1()">

function action1()
{ //etc...
document.myform.action = "main.asp"
}

So which is the appropriate way? please advise. thanks!!

Jul 19 '05 #3

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

Similar topics

2
3127
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as they want. If they need to add more, they click an "add name" button and the javascript inserts another row of input boxes. Each row should have...
0
2683
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main form. Then I have 3 pages on a tab control ( 4 if the type of candidate validates that is is to be shown) Each page has a subform. The subforms can...
3
2550
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...
8
579
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
7
3086
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form as follows: Friend F0 As frmMain Friend F1 As frmStart Friend F2 As frmSearch Then in my ShowPage routine (which is passed a string "pageToShow"...
5
19992
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...
5
14104
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
4
2068
by: ApexData | last post by:
I have a continuous form that has Allow- Add/Edit/Del set to False, so that the form is in View mode only. I have New/Edit/Del buttons in the form header. My New & Edit buttons work as a like. My Del button works great also, but for one record at a time only. In ViewOnly mode, the user is able to highlight a single record to delete...
2
6925
by: 6afraidbecause789 | last post by:
Hi - Has anyone ever used toggle buttons to select items in a listbox? I'd like to put about 24 toggle buttons on an unbound form that select or deselect items in a multiple select listbox. I've come across a way to set the listbox value to only 1 at a time, but need multiple toggle buttons to be on their corresponding listbox item values...
0
7276
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...
0
7408
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. ...
0
7548
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...
0
5714
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...
0
4773
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...
0
3267
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...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
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...

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.