Skip to main content
Known Participant
April 19, 2009
Question

Session problems

  • April 19, 2009
  • 1 reply
  • 533 views

I'm having a problem with my Application.cfm and session variables.

I have a diary / jobs list page and I'm using session variables to hold most of the variables as the screen updates between different views.

Application.cfm:

<cfapplication
name="diary"
    setdomaincookies="yes"
    clientmanagement="no"
    sessionmanagement="yes"
    setclientcookies="yes"
    sessiontimeout="#CreateTimeSpan(0, 1, 0, 0)#"
>

        <cfif not isDefined('session.diary')><cfset session.diary = "daily"></cfif>
        <cfif not isDefined('session.showNotes)><cfset session.showNotes= "N"></cfif>
        <cfif IsDefined("form.diary")>   <cfset session.diary = "#form.diary#">     </cfif>
        <cfif IsDefined("form.showNotes")>   <cfset session.showNotes= "#form.showNotes#">     </cfif>

The problem:

I have links on the pages for different options,

     Current state: Daily Diary, hide notes

Click on "pending" diary

     <input name=diary value=pending>

     Current state: pending diary, hide notes (from session.ShowNotes)

Click on "Show NOtes"

    <input name=showNotes value=Y>

     Current state: daily diary, show notes

The last state should be pending diary, show notes but the session variables seem to have been forgotten and reverted to the default.

What have I missed?

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    April 19, 2009

    For a start, the input tag should have a type attribute and the value of form attributes should be within double quotes. For example,  <input type="text" name="showNotes" value="Y">

    Known Participant
    April 19, 2009

    My input tags are syntaxically correct in the actual file, I only wrote here the relevant parts, mainly to show that there was other non-relevant info missing e.g. more fields.