Yep, you will require two forms and you could trigger them via JS OR you
could use Javascript alone and submit the form[s] with certain parameters.
document.form[0]{formname}.submit();
N
-----Original Message-----
From: Andy Ousterhout [mailto:[EMAIL PROTECTED]
Sent: 28 February 2003 12:38
To: CF-Talk
Subject: RE: Cold Fusion - Search functionality with shopping cart
w/HTML CFM code
Deetra:
When I want to have two different actions depending on which button is
pushed, I always use 2 different forms. I only see one form.
Andy
-----Original Message-----
From: Deetra Whatley [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 1:31 AM
To: CF-Talk
Subject: Cold Fusion - Search functionality with shopping cart w/HTML
CFM code
Good Day,
I have created a shopping cart form in ColdFusion using the application
sessions from the Advanced Cold Fusion class. That functionality works
fine. AlsoI have created the Search functionality from the Fast Track to
ColdFusion class.
Purpose: The tape.cfm form displays all of the sermons. The user can
select a sermon and add to the shopping cart. I also want the user to
search sermons by a minister's name and I would like for the search results
to appear in the table below on tape.cfm. In addition, the customer can add
those search results sermons to the shopping cart. The customer can
continue shopping and select a new search result.
Problem: This is where I am slightly confused and still learning Cold
Fusion
At the top of the page, I have the Search by Minister search section.
When a user selects a minister choice from the drop down menu and click the
GO button, I want the search results to appear in the table below.
I have created two GO buttons for testing purposes.
The first GO button I am using the
/tape.cfm?SPEAKER=#variable.MinisterSpeaker and that is not working for me.
The search results do not display in the table. Once I have made a
selection, the selection doesn't remain in the drop-down menu and it returns
to the All Minister choice. Nothing happens if I make a another selection.
The second GO button is an input field using the tape.cfm action page.
That works fine. But I don't want tape.cfm as an action page because I want
cart.cfm as the action page for the shopping cart functionality.
Question: At this point, I have looked at this tape.cfm and I am not sure
what I have done wrong. I am asking for your assistance or suggestions.
What should I do?
Desired Result: A user selects a minister's choice from the drop-down
menu, the search results appear in the table. And the customer can add the
item to the shopping cart. I would like all of this functionality in the
tape.cfm.
The following webpage is what I woudl like to accomplish.
http://ww2.micahtek.com/nexolive/nShop_Store.cfm?CFID=1956341&CFTOKEN=462400
21&MKID=8B188D5A-4A68-11D7-A3D400B0D022E580 or
http://www.thepottershouse.org/PH_eventcntr.html click on Online Bookstore
WebPages:
I have attached the tape.cfm and the MS Access database
The acutal webpage will be http://www.turnerame.org/resources/tape.cfm
I know that this is probably a simple fix. But I just cannot see it right
now. I would appreciate it if you could look at this.
Thank you for your time again.
Deetra Whatley
I don't think that I can attach files. Here is the HTML/CFM code.
<cfcontent type="text/html; charset=iso-8859-1">
<cfparam name="URL.start" default="1">
<cfset last=URL.start-10>
<cfset next=URL.start+10>
<!--- Number of rows to display per Next/Back page --->
<cfset RowsPerPage = 10>
<!--- Total number of rows from query --->
<CFSET TotalRows=application.qGetSermon.RecordCount>
<!--- Last row is 10 rows past the starting row, or --->
<!--- total number of query rows, whichever is less --->
<cfset EndRow=Min(URL.start + RowsPerPage - 1, TotalRows)>
<cfquery name="application.qGetSermon" datasource="tmame_tapes"
cachedwithin="#CreateTimeSpan(1,0,0,0)#">
SELECT ID, DATE, TIME, SUBJECT, SPEAKER, OCCASION, CHOIR, PRICE, QUANTITY
FROM Tapes
WHERE 0=0
<cfif isDefined("Form.Minister_Speaker") AND trim(Form.Minister_Speaker)
is not "">
AND SPEAKER IN (#ListQualify(trim(Form.Minister_Speaker),"'")#)
</cfif>
ORDER BY Date DESC
</cfquery>
<cfquery name="qGetMinisters" datasource="tmame_tapes" >
SELECT DISTINCT SPEAKER
FROM Tapes
ORDER BY SPEAKER ASC
</cfquery>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h3>Tape Ministry Orders</h3>
<cfform action="tape.cfm" method="post" name="tape">
<table border="0" cellpadding="0" cellspacing="5" width="575">
<tr>
<td colspan="3" class="boldattribute">Search by Minister</td>
<td colspan="3" class="boldattribute">Search by Keyword</td>
</tr>
<tr>
<td colspan="3" >
<select name="Minister_Speaker" size="1">
<option value="" >All Ministers</option>
<cfoutput query="qGetMinisters">
<option value="#qGetMinisters.SPEAKER#">#SPEAKER#</option>
</cfoutput>
</select>
<!--- <cfif isDefined("Form.Minister_Speaker")> </cfif>
(#ListQualify(trim(Form.Minister_Speaker),"'")#)isDefined("Form.Minister_Spe
aker")--->
<cfset MinisterSpeaker = "#qGetMinisters.SPEAKER#">
<a
href="../resources/tape.cfm?SPEAKER=#variable.MinisterSpeaker#">
<img src="../images/gobutton.gif" alt="Search by Ministers"></a>
<a href="../resources/tape.cfm" ><input type="image"
src="../images/gobutton.gif" name="Operation" value="Search by
Ministers"></a>
</td>
<td colspan="3" ><cfinput type="text" name="Keyword">
<a href="../resources/tape.cfm" ><img src="../images/gobutton.gif"
alt="Search Keyword"></a>
<input type="submit" name="Operation" value="Keyword">
</td>
</tr>
<tr>
<td colspan="6">
<a href="../resources/cart.cfm" ><img src="../images/shop_view.gif"
alt="View Cart"></a>
</td>
</tr>
<tr>
<td colspan="3" class="tableText">
<cfoutput>
Displaying <strong>#URL.start#</strong> to <strong>#EndRow#</strong>
of <strong>#TotalRows#</strong> Records
</cfoutput><br> <br>
</td>
<td colspan="3" class="tableText" align="right">
<!--- Place Previous and Next links here --->
<cfoutput>
<cfif URL.start NEQ 1>
<a href="tape.cfm?start=#variables.last#"><< Previous </a>
</cfif>
<cfif TotalRows gte variables.next>
<a href="tape.cfm?start=#variables.next#">Next >></a>
</cfif>
</cfoutput>
</td>
</tr>
<tr>
<th align="left">Date</th>
<th align="left">Time</th>
<th align="left">Sermon</th>
<th align="left">Minister</th>
<th align="left">Price</th>
<th align="left">Quantity</th>
</tr>
<cfoutput query="application.qGetSermon" maxrows="10"
startrow="#URL.start#">
<tr>
<td valign="top" width="50"
class="tableText">#DateFormat(application.qGetSermon.Date,"MM/DD/YYYY")#</td
>
<td valign="top" width="75"
class="tableText">#TimeFormat(application.qGetSermon.Time,"hh:mm tt")#</td>
<td valign="top" width="175"
class="tableText">#application.qGetSermon.Subject#</td>
<td valign="top" width="150"
class="tableText">#application.qGetSermon.Speaker#</td>
<td valign="top" width="35"
class="tableText">#DollarFormat(application.qGetSermon.Price)#</TD>
<td valign="top" align="center" >
<cfinput type="text"
name="quantity_#application.qGetSermon.ID#"
size="1"
maxlength="4"
validate="integer"
message="You must enter a valid quantity (<1000)">
</td>
</tr>
</cfoutput>
<tr>
<td colspan="6" align="right"> <input name="add" value="Add to
Cart" type="submit">
<a href="../resources/tape.cfm" >
<input name="addshopcart" value="Add Cart" type="image"
src="../images/shop_add.gif" >
</a>
<!--- <a href="../resources/cart.cfm"><img
src="../images/shop_add.gif" name="addcart" alt="Add to Cart"></a> --->
</td>
</tr>
<tr>
<td colspan="6" align="right" class="tableText">
<!--- Place Previous and Next links here --->
<cfoutput>
<cfif URL.start NEQ 1>
<a href="tape.cfm?start=#variables.last#"><<
Previous </a>
</cfif>
<cfif TotalRows gte variables.next>
<a href="tape.cfm?start=#variables.next#">Next >></a>
</cfif>
</cfoutput> </td>
</tr>
</table>
</cfform>
</body>
</html>
Thank you for your time again.
Deetra Whatley
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4