[thelist] 2 targets for a form

matthew garrett matthew.garrett at snet.net
Fri Feb 22 17:06:01 CST 2002


> From: Peter <peter at poorbuthappy.com>

> another pretty dumb question: if I have a form with 2 submit buttons in it,
> can I have these go to two different target pages? I did some searches but
> couldn't find any answers... I don't want to send them to the same page
> because that complicates tracking via the server logs.

2 non-javascript solutions/hacks come to mind:
You could attach 2 different values to the 2 different submit buttons, and
then have the target page include a different file based on the value which
is passed. In CF it might go something like this

<cfif form.button1>
    <!--- include a nearly blank page to set the log entry --->
    <!--- OR have the included page process the form --->
    <cfinclude template="they_clicked_the_first_button.cfm">
<cfelseif form.button2>
    <!--- include a different nearly blank page to set the log entry --->
    <!--- OR have the included page process the form --->
    <cfinclude template="they_clicked_the_second_button.cfm">
</cfif>

<cfdostuff>
    <!--- process the form however you like --->
</cfdostuff>

Something like that anyway. It looks flexible enough to start with.

hth,
matt g




More information about the thelist mailing list