472,802 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,802 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 6971
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.