problem is you have 2 form fields named 'select' (which, i should
point out, is probably not the best name for a form field...but that's
neither here nor there at the moment).

if you do a <cfdump var="#form#"> at the top of the page, you'll see
your value for form.select is actually a comma-delimited list.  that's
how form fields with the same name get handled.  a comma delimited
list of the values on the action page.

drop the hidden field...unless it's there for some reason that i'm not seeing...


On 10/12/06, Rick King <[EMAIL PROTECTED]> wrote:
> I have a products page, that has a sort feature allowing a user to sort 
> products by price, size etc. I can't figure out why the following code isn't 
> working. When I select a sort criteria, it just reruns the query, without 
> sorting. Any ideas?
>
> Thanks
> R
>
>
> <cfparam name="type" default="All Items">
> <cfparam name="URL.Category" default="">
> <cfparam name="URL.CatID" default="">
> <cfparam name="URL.ProdID" default="">
> <cfparam name="FORM.select" default="Size_Small">
>
> <cfquery name="getproducts" datasource="DB">
> SELECT P.ProdID, P.Designer, P.Size, P.Price, I.Image, I.IsPrimary, C.Category
> FROM Products P, Images I, Category C
> WHERE P.ProdID = I.ProdID
> AND P.CatID = C.CatID
> AND IsPrimary = 'Yes'
> AND Status = 'Approved'
>
> <cfif URL.Category EQ 'Shirts'>
> <cfset type = 'Shirts'>
> AND C.CatID = 1
> </cfif>
>
> <cfif URL.Category EQ 'Pants'>
> <cfset type = 'Pants'>
> AND C.CatID = 2
> </cfif>
>
> <cfif URL.Category EQ 'Accessories'>
> <cfset type = 'Accessories'>
> AND C.CatID = 3
> </cfif>
>
> <cfif FORM.select EQ "Size_Lrge">
> ORDER BY DressSize
> </cfif>
>
> <cfif FORM.select EQ "Size_Small">
> ORDER BY Size DESC
> </cfif>
>
> <cfif FORM.select EQ "Price_Lo">
> ORDER BY Price DESC
> </cfif>
>
> <cfif FORM.select EQ "Price_Hi">
> ORDER BY Price
> </cfif>
>
> <cfif FORM.select EQ "Designer">
> ORDER BY Designer
> </cfif>
>
> </cfquery>
>
>
> <form name="reorder" method="post" 
> action="products.cfm?category=#URLEncodedFormat(URL.category)#">
> <INPUT TYPE="hidden" NAME="select" VALUE="#FORM.select#">
> <table width="600" border="0" align="center">
> <tr >
> <td>Items Found: <b><cfoutput>#getproducts.RecordCount#</b><br>Category: 
> <b>#type#</b></cfoutput> </td>
> <td><div align="right" style="padding-right:45px; ">Sort by
> <select name="select" style="font-size:11px; ">
> <option value="" >--Select--</option>
> <option value="Size_Lrge" >Size: Large to Small</option>
> <option value="Size_Small" >Size: Small to Large</option>
> <option value="Price_Lo">Price: Low to High</option>
> <option value="Pric_Hi">Price: High to Low</option>
> <option value="Designer">Designer</option>
> </select>
> <input name="Submit" type="submit" value="Sort >" style="font-size:11px; 
> color:#2f95cf;">
> </div></td>
> </tr>
> </table>
> </form>
>
>
> <table width="600" border="0" cellpadding="10" cellspacing="0" align="center">
> <cfoutput query="getproducts" >
> <td align="center" valign="top">
> <p>
>
> <a href="details.cfm?ProdID=#getproducts.ProdID#"><img 
> src="users/uploads/#getproducts.Image#" width="100" style="border:1px solid 
> ##E0E0E0; padding:8px;"></a><br />
> <span class="titles">Designer:</span> #getProducts.Designer#<br>
> <span class="titles">Dress Size:</span> #getProducts.Size#<br>
> <span class="titles">Price:</span> #DollarFormat(getProducts.Price)#<p>
> <br>
> <p></p></td>
> <cfif getproducts.currentrow mod 3 EQ 0>
> </tr>
> </cfif>
> </cfoutput>
> </table>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256597
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to