473,395 Members | 1,653 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,395 software developers and data experts.

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 7005
Hello,

<input type='button' name='btnPreview' onclick='this.form.submit()'
value="Submit">
<input type='button' name='btnSubmit'
onclick='this.form.action="myAction.php"; this.form.submit()'
value="Submit">

--
Elias
"M Wells" <pl**********@planetthoughtful.org> wrote in message
news:dk********************************@4ax.com...
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.org> wrote:
<input type='button' name='btnPreview' onclick='this.form.submit()'
value="Submit">
<input type='button' name='btnSubmit'
onclick='this.form.action="myAction.php"; this.form.submit()'
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**********@planetthoughtful.org> wrote:
On Mon, 8 Dec 2003 14:52:34 +0200, "lallous" <la*****@lgwm.org> wrote:
<input type='button' name='btnPreview' onclick='this.form.submit()'
value="Submit">
<input type='button' name='btnSubmit'
onclick='this.form.action="myAction.php"; this.form.submit()'
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
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...
8
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...
1
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...
4
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...
5
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...
3
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...
0
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
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...
7
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...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...
0
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...
0
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...
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...

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.