How do I initialize <cfparam name="SESSION.catagory_level" or make it not use
the default and use "5" in some cases?
Here is what I have:
<cfparam name="SESSION.catagory_level" default="1">
<cfquery name="catagory" datasource="#APPLICATION.datasource_name#"
dbtype="Query">
SELECT *
FROM catagory
WHERE catagory_level = #SESSION.catagory_level#</cfquery>
Here is what else I have on the same browse page:
<form action="catagory_action.cfm" method="post" name="get_catagory"
id="get_catagory">
You are in category
<select name="catagory" onchange="get_catagory_onchange_submit()">
<cfoutput query="catagory"> <option value="#catagory#"<cfif SESSION.catagory
IS "#catagory#" AND SESSION.catagory_level =
"#catagory_level#">SELECTED</cfif>>#catagory#</option></cfoutput>
</select>
</form>
<cfparam name="URL.o" default="actual_filename">
<cfquery name="get_files" datasource="#APPLICATION.datasource_name#"
dbtype="Query">
SELECT library.ID, library.TitleSubject, library.PresenterAuthor,
library.AudienceType, library.GivenTo, library.Synopsis, library.Objective,
library.actual_filename, library.server_filename, library.file_extension,
library.file_size, library.catagory, library.comments, library.upload_date,
user.first_name, user.last_name
FROM library LEFT JOIN [user] ON library.username = user.username
WHERE library.catagory = '#SESSION.catagory#'
ORDER BY #URL.o#</cfquery>
I want it to differentiate by users catagory_level. Default "1" sometimes "5".
How do I carry the specific <cfparam session.catagory_level> to the browse
page or tell it to initialize from the catagory_level the user has?
Kind regards,
CS
ayhanyildiz - 30 Sep 2004 04:23 GMT
use cookies or client variables to store customer selection.
repressed radar - 30 Sep 2004 16:55 GMT
I want to do this and I seem to have gotten myself confused.
<cfparam name="URL.username" default="1">
<cfquery name="catagory" datasource="#APPLICATION.datasource_name#"
dbtype="Query">
SELECT catagory_level
FROM "user"
WHERE username = '#URL.username#'</cfquery>
<cfparam name="catagory_level" default="<cfoutput
query>#catagory_level#</cfoutput>">
See the ...
<cfoutput query>.#catagory_level#</cfoutput>
How do I make the --- output value, the value of the variable? So it
says
<cfparam name="catagory_level" default = "what ever the assigned level is for
that user"
ERROR Message says variable Not defined but it is defined in the database.
repressed radar - 30 Sep 2004 19:00 GMT
Ok. Got it.
1. Because in my application.cfm I put in:
<cfapplication name="Sales"
clientmanagement="Yes"
sessionmanagement="Yes"
setclientcookies="Yes"
sessiontimeout="#CreateTimeSpan(0,0,20,0)#">
2. I needed to set my "Session.catagory_level" in my user validate.cfm page:
<CFIF C.RecordCount EQ 1> <!--- Validate User --->
<CFSET SESSION.VALIDATED = "Y">
<CFSET Session.username = "#trim(C.username)#">
<CFSET Session.security_level = "#C.security_level#">
<cfset Session.catagory_level = "#C.catagory_level#">
3. Then as in my original code I can use the <cfparam>
<cfparam name="SESSION.catagory_level" default="1">
4. So...THIS HOW I can use a "Client Variable" as Ayhanyildiz suggested!
Many thanks for setting me back on track!