469,610 Members | 1,554 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

Changing submit function according to what user selects in pulldown list

I have made a form at http://www.lcuk.org/cleanair/form.htm

In the Financial Information section there is a question "How do you
wish to pay?"

If the user selects "invoice" then when the user hits submit I want
the form simply to call a formmail.cgi script and email the contents
to me.

However if the user selects "credit card" then I need to pass the form
contents to a second form (http://www.lcuk.org/cleanair/form2.htm) to
be held on a secure server so that the user's credit card details can
be given. The details from the first form need to be written to the
corresponding boxes on the second form.

Is there a way to do all this?

I'm new to all this and would really appreciate some help! Please
assume I'm stupid and know nothing...
Jul 20 '05 #1
2 1329
Claire Osborne wrote:
I have made a form at http://www.lcuk.org/cleanair/form.htm

In the Financial Information section there is a question "How do you
wish to pay?"

If the user selects "invoice" then when the user hits submit I want
the form simply to call a formmail.cgi script and email the contents
to me.

However if the user selects "credit card" then I need to pass the form
contents to a second form (http://www.lcuk.org/cleanair/form2.htm) to
be held on a secure server so that the user's credit card details can
be given. The details from the first form need to be written to the
corresponding boxes on the second form.

Is there a way to do all this?

I'm new to all this and would really appreciate some help! Please
assume I'm stupid and know nothing...


Most reliable way? Submit the form to someScript.cgi and have
someScript.cgi check the payment method and redirect accordingly.

Javascript way? onSubmit, call a function that will set the forms action
property and then submit the form. Doesn't work with js disabled.

Alternative:
Use both. Set the action of the form to the someScript.cgi, and onSubmit
have JS check the payment method, and reset the forms action. Then, if
JS is disabled, the server handles it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #2
In article <12**************************@posting.google.com >,
cl****@interface-web.co.uk enlightened us with...
I have made a form at http://www.lcuk.org/cleanair/form.htm


This is an internet application. Do not rely on javascript for internet
applications. You're asking for problems if you do. Not everyone has JS
enabled. What would happen to those people?

IOW, use server-side code to do this for internet applications. Have the
form submit to a page that checks which option to do, then that page
does the appropriate thing.
Most (if not all) server-side scripting languages have the ability to
forward. Edit your formmail script to forward to the other html page if
appropriate.
Check a perl group for details.
--
--
~kaeli~
The definition of a will?... (It's a dead giveaway.)
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Deidre | last post: by
2 posts views Thread by ColinWard | last post: by
15 posts views Thread by Sonnich | last post: by
Frinavale
13 posts views Thread by Frinavale | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.