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

Home Posts Topics Members FAQ

Conditional submit of form?

Hi All,

I'm trying to build a page where a user can enter comments and I want
to add a 'Preview' button to the form.

When the user clicks on the 'Preview' button I'd like the same form to
submit to the current page, however, when the user clicks on the
submit button, I'd like the form to submit to another processing page.

In other words, I basically want two distinct form actions -- one to
handle the click of the Preview button, the other to hand the click of
the Submit button.

If anyone can help me achieve this I'd appreciate it very much!

Many thanks in advance...

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.
Jul 20 '05 #1
3 7015
Hello,

<input type='button' name='btnPrevie w' onclick='this.f orm.submit()'
value="Submit">
<input type='button' name='btnSubmit '
onclick='this.f orm.action="myA ction.php"; this.form.submi t()'
value="Submit">

--
Elias
"M Wells" <pl**********@p lanetthoughtful .org> wrote in message
news:dk******** *************** *********@4ax.c om...
Hi All,

I'm trying to build a page where a user can enter comments and I want
to add a 'Preview' button to the form.

When the user clicks on the 'Preview' button I'd like the same form to
submit to the current page, however, when the user clicks on the
submit button, I'd like the form to submit to another processing page.

In other words, I basically want two distinct form actions -- one to
handle the click of the Preview button, the other to hand the click of
the Submit button.

If anyone can help me achieve this I'd appreciate it very much!

Many thanks in advance...

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

Jul 20 '05 #2
On Mon, 8 Dec 2003 14:52:34 +0200, "lallous" <la*****@lgwm.o rg> wrote:
<input type='button' name='btnPrevie w' onclick='this.f orm.submit()'
value="Submit" >
<input type='button' name='btnSubmit '
onclick='this. form.action="my Action.php"; this.form.submi t()'
value="Submit" >


Hi,

Thank you -- this was exactly what I was looking for!

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.
Jul 20 '05 #3
On Thu, 11 Dec 2003 02:31:40 GMT, M Wells
<pl**********@p lanetthoughtful .org> wrote:
On Mon, 8 Dec 2003 14:52:34 +0200, "lallous" <la*****@lgwm.o rg> wrote:
<input type='button' name='btnPrevie w' onclick='this.f orm.submit()'
value="Submit ">
<input type='button' name='btnSubmit '
onclick='this .form.action="m yAction.php"; this.form.submi t()'
value="Submit ">

Thank you -- this was exactly what I was looking for!


Perhaps not what all your visitors are looking for though. As I just
mentioned in another thread, this results in the form being unusable for
anyone without Javascript (and potentially so for anyone with an unusual
Javascript dialect). Use input type=submit for the "real" submit button
and type=button (or a button element) for any nice-to-have extras.

--
Stephen Poley
Jul 20 '05 #4

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

Similar topics

1
1389
by: Eduardo Biano | last post by:
Hi, I have a problem making conditional testing (if) of a form variable "ans01"(refer generated error). When the form variable is tested (if) by a called function (foo) the value of "ans01" is not properly represented. def foo(request):
8
1868
by: Guy Hocking | last post by:
Hi there, I am having a few problems compiling a list box that is conditional on what is selected in another list box. What i need is a List box (lstArea) that displays one thing when the List Box (lstRegion) is selected East or West. Basically the areas will change when East or West is selected in lstRegion. The data comes from an SQL Server view, and my current non-working code is as follows, my syntax in the SQL statement is...
1
4304
by: Orest Kinasevych | last post by:
Okay, I made sense of the earlier suggestions and realized I was on the right track -- I appreciate the feedback which got me to this point. The suggestions posted here indeed worked and eliminated the JavaScript errors I was seeing. The fact that the target URL didn't execute was because certain variables weren't being passed to it. What I need to do is to pass a conditional variable to the target URL, when the form is submitted,...
4
2301
by: Sjon | last post by:
Here's A piece of my code: <form action="dimensions.php" method="POST"> <br><input type="radio" style="background : #84c7e8" name="categorie" value="Customer" checked> Customer</br> <br><input type="radio" style="background : #84c7e8" name="categorie" value="Employee"> Project Manager</br> <br><input type="radio" style="background : #84c7e8" name="categorie" value="Vendor" > Vendor</br> <br><input type="submit" name="submitknop"...
5
6382
by: Raffi | last post by:
Hi, I have a form that has 2 submit buttons. The form action is a php script. What I'm trying to do is to execute a different javascript function depending on which submit button is pressed. So far I've tried the following with no success. In the code below, a different function would execute based on the value of the "flag" variable. <HTML> <HEAD>
3
5927
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be terminated by pressing ++ and then terminate the process. I searched the entire internet and found out that there could be two things wrong (both of them are mentioned in the bug list on the access
0
657
by: GGerard | last post by:
Hello With MSAccess 2000, I have created a program with forms and applied some Conditional Formatting on some of the text box.
16
1753
by: Art | last post by:
Can anyone help. I've tried scaling down a script to the bare minimum and it still is not working correctly. What I think should happen is that when the field app_fname is blank, that $hold_chk will get set to 1 and the 1st if statement will be executed. What actually happens is that when I hit submit, the form stays where it is, for example if the form where the submit button is located is on the form other.php, then when I hit submit...
7
1751
by: simon2x1 | last post by:
i have an upload form that upload image into a folder i want the upload field not to post a blank field and also not to allow any image which is not gif, jpeg and png not to be uploaded how can i do these with javascript. the code below is my upload form code <form name="the_form" id="the_form" method="POST" action="uploaded.php" enctype="multipart/form-data"> <input name="images" type="file" id="field_1" > <input...
0
8392
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
8305
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
8503
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,...
1
6163
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
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
4301
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
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
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.