Click to See Complete Forum and Search --> : multiple [Submit] buttons


Chris Morton
05-01-2003, 05:18 PM
I need to have this form get routed to different e-mail locations based upon which [Submit] button is clicked. Right now, the form only has one [Submit]. How do I add more--individually named--PLUS have the "Confirm" msg displayed?

<head>
<script type="text/javascript">
function confirmInput()
{
alert("Your survey results have been mailed to Carly Fiorina");
}
</script>
</head>

<body>
<form onsubmit="confirmInput()" action="MAILTO:carly.fiorina@hp.com" method="post" enctype="text/plain">
<input type="submit" value="Submit Comments"> <input type="reset" value="Clear Form">
</form>
</body>

Jona
05-01-2003, 05:22 PM
Use <input type="button" value="Email jon" onClick="this.form.action='mailto:jon@cool.net';this.form.submit();"><br>
<input type="button" value="Email joe" onClick="this.form.action='mailto:joe@cool.com';this.form.submit();">

Chris Morton
05-01-2003, 05:24 PM
Nice, but what about the confirmation message (that's the purpose of the JavaScript function in the HEAD)?

Jona
05-01-2003, 05:26 PM
<input type="button" value="Email jon" onClick="this.form.action='mailto:jon@cool.net';this.form.submit();alert('Your email to Jon Cool has been sent.');"><br>
<input type="button" value="Email joe" onClick="this.form.action='mailto:joe@cool.com';this.form.submit();alert('Your email to Joe Cool has been sent.');">

Chris Morton
05-01-2003, 05:27 PM
Tx for the ultra-swift replies!

Jona
05-01-2003, 05:28 PM
You're welcome. ;)

Chris Morton
05-01-2003, 05:43 PM
This doesn't work. First, see the attached JPG regarding the sequence of events. Not only do I not want a blank e-mail form to appear (middle shot), but the form results do not get sent to me regardless of what the confirmation message says. (The initial warning message is expected and is OK.)

Jona
05-02-2003, 09:54 AM
Why don't you use multiple forms and a server-side language? Whatever you're trying to do, it has nothing to do with my code. Because my code is fine.

Chris Morton
05-02-2003, 10:40 AM
I'm not faulting your code; I know there are quirks involved, not the least of which is FrontPage 2000 with its known issues.

Getting server-side stuff installed here requires an act of God; rather, I know there are usually > six ways to accomplish the same task in the world of computers and I'm merely looking for an alternate way to accomplish the multiple submit using a single form (at the request of a manager with whom I work).

To illustrate, when I initially couldn't get the onClick method to send me the form using a single submit button, someone in one of these forums proposed this code at the top of the <BODY> section:

<form onsubmit="confirmInput()" action="MAILTO:chris.morton@hp.com" method="post" enctype="text/plain">

This works swell, the confirmInput() being a JavaScript routine in the <HEAD> that posts the confirmation message for the benefit of the respondent. Perhaps a variation of this technique could be employed, using an IF > THEN check against some respondent data in the .JS and, based on the variable, dispatch the completed form to the appropriate party? Here's the .JS code:

<script type="text/javascript">
function confirmInput()
{
alert("Your survey results have been mailed to Chris Morton. Thanks for participating!")
}
</script>

And here is an appropriate variable elsewhere in the form for use in determining how to route the completed form:

<input type="radio" value="HPSE" name="Job">
<input type="radio" value="GSO" name="Job">
<input type="radio" value="WFM" name="Job">

Mine is not to ask why nor to say it cannot be done; mine is to find a viable solution. If we absolutely HAVE to go to the multiple-form route, then that becomes the viable solution. But being stubborn and wanting to make the original concept work if I can, I want to investigate alternatives, especially when I'm repeatedly told a single form with multiple submits *IS* viable.

Anyway, thanks for hanging in there with me. I value your contribution and did not intend to suggest that any fault lay with your code... I know we have internal issues here that are prohibiting it from working so the onus lays with us. :)

Jona
05-02-2003, 11:57 AM
I don't understand. This makes no sense. I gave you the code that will work. Now, either use server-side, the code I gave you, or better explain what is wrong with having an empty email field. If you want to submit a form, you should always use server side; and since I have never used a mailto action in my form, I do not understand in the least bit what you're trying to accomplish.