Skip to main content
November 29, 2010
Question

Session variable reverting to default value.

  • November 29, 2010
  • 1 reply
  • 2540 views

Hi, I have created a page builder of sorts using form inputs. This was working correctly until a few hours ago and I dont know what happened or what I did to cause this issue. The issue is with the "fileName" form input. When a user inputs a filename, it's saved as an html file. In my application.cfm file, I have set fileName as the cfparam with a default value= "none".

Not only does the default value get used, but most of my form variables are not passed either.

here is my application code:

<!--- Name application, and enable Application variables --->
<cfapplication name="pageBuilder2" sessionmanagement="Yes">
<cfparam name="SESSION.fileName" default="" type="any">
<cfparam name="SESSION.styleSheet" default="" type="any">

Here is my form page with the input fields:

<table>
    <tr>
      <th width="258" bgcolor="#CCCCCC">Page File Name:</th>
      <td width="253"><cfinput type="text" name="filename" id="fileName" value="#SESSION.fileName#"></td>
      <th width="73" bgcolor="#CCCCCC">Page Title:</th>
      <td width="144"><cfinput type="text" name="pageTitle" id="pageTitle" value="#SESSION.pageTitle#"></td>
      <th width="114" bgcolor="#CCCCCC">Page StyleSheet:</th>
      <td width="191"><cfinput type="text" name="styleSheet" id="styleSheet" value="#SESSION.styleSheet#"></td>
    </tr>

</table>


Here is where I set my SESSION variables to = my FORM variables:

<cfset SESSION.fileName = FORM.fileName>

    This topic has been closed for replies.

    1 reply

    Inspiring
    November 29, 2010

    can you list what your filenames are? I see you have an Application.cfm, but where's the form display code and the action processing code. it's not all in application.cfm, is it?

    In your page that processes the form, what do you see when you do:

    <cfdump var="#form#">

    <cfdump var="#session#">

    ?

    November 29, 2010

    The filenames are created by user input. For example, if I were to be creating a new page for my website, and I wanted to name the new page "bulb60419dl.html" then I would type "bulb60419dl" into the fileName form field.

    When i cfdump my form and session variables, everything seems to pass correctly. This might suggest that I have some wrong code in my fileWrite page. The action page is used as sort of a preview to make sure the page looks correct BEFORE the file is written and finalized. Something is changing the value of FORM.fileName once its passed to the fileWritepage.cfm.

    Inspiring
    November 29, 2010

    It'd be helpful to not have to guess what the code involved is... what's the code that runs after the form is submitted, through until when you write the file?

    --

    Adam