Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Keep WHERE Value while performing a Header Sort

0 views
Skip to first unread message

mathetes

unread,
Feb 4, 2005, 5:36:06 PM2/4/05
to
I have a problem. I use a url link to pass sort order and it works fine. I also
use a form as a search results filter that works fine. The problem that I have
is once I have used the form to limit my results, I cannot figure out how to
get my URL header sort to refresh the page while keeping the limited results.
The page just refreshes and I get unfiltered results. I would also like to
limit my results to the 1st 25. Then have a NEXT>25 link to go through the
results. Well at any rate I can figure that out easy enough, but am pretty sure
that my URL Header sort will not work there either..

<cfif parameterexists (url.sortID) IS "yes">
<cfset var_sort = url.sortID>
</cfif>

<CFQUERY NAME="view_archive_entry" DATASOURCE="#Application.Midwar#">
Select *
FROM #application.tablename#
Where ArchiveID = ArchiveID
<cfif parameterexists (Form.search) is "yes">
<cfif Form.search is not "">
And title
Like '%#Form.search#%'
OR summary
Like '%#Form.search#%'
Or date_posted
Like '%#Form.search#%'
Or keywords
Like '%#Form.search#%'
</cfif>
</cfif>
order by #var_sort#
</CFQUERY>

<!--- This is what I am using as a header sort --->
<a href="?sortID=title" target="_self">
Sort By Title</a>

bubblocity

unread,
Feb 6, 2005, 4:31:00 PM2/6/05
to
Try this:

1) Add hidden variable in your form
<input type="hidden" name="sortID" value="<cfoutput>#var_sort#</cfoutput>">

2) Modify this chunk of code


<cfif parameterexists (url.sortID) IS "yes">
<cfset var_sort = url.sortID>

<cfelseif parameterexists (form.sortID) IS "yes">
<cfset var_sort = form.sortID>
</cfif>

Also, Just a random guess, did you want parentheses around your OR section in
the query.

<cfif Form.search is not "">
And (title


Like '%#Form.search#%'
OR summary
Like '%#Form.search#%'
Or date_posted
Like '%#Form.search#%'
Or keywords

Like '%#Form.search#%' )
</cfif>


mathetes

unread,
Feb 10, 2005, 2:02:37 PM2/10/05
to
Thank you that helped...
0 new messages