Skip to main content
Participating Frequently
March 13, 2007
Question

Role Declaration Erroe

  • March 13, 2007
  • 2 replies
  • 274 views
Hi,
I am getting the following error with the following code.

I have a Header.cfm which has some different tabs. For this application there are different type of users(Administrator, Constructor...for which the tabs on header.cfm varies)

<cfif Session.Role EQ "Constructor">
<td background="images/head.jpg" ><a href="demos/Demos.htm" target="_blank" class="navLink">Check Demo</a></td>
<cfelseif Session.Role EQ "Administrator">
<td background="images/head.jpg" ><a href="Administrator.cfm" class="navLink"> Administrator</a></td>
</cfif>

If use the above code, some time the following error appears which occurs ocassionally..

Element ROLE is undefined in Session at line <cfif Session.Role EQ "Constructor">
in the above code. could you please help me out in this issue
    This topic has been closed for replies.

    2 replies

    Inspiring
    March 13, 2007
    Cfherozzz, in response to your first post -

    One possibility is that you ColdFusion session is timing out, thus when you try and access the page, the session variables no longer exist. I would take a look at the session timeout settings in your application.cf(m|c) file and the CF administrator. If they are timing out, you should make sure that you handle that situation appropriately (e.g. redirect to a log in page)
    Inspiring
    March 13, 2007
    you will have to provide a lot more info than just that snippet of code
    to solve the problem..

    the reason for the error is stated in the error message:
    you do not have "Role" key defined in the Session structure. Why it is
    not is another question:
    start by posting the code you use to set the ROLE key in the Session scope

    --

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com
    CfherozzzAuthor
    Participating Frequently
    March 13, 2007
    Hi,

    I need asmall help in Java Script.

    I have one check box and a drop downlist. What I need is, when I check the chek box, the drop down list should be Enable/Visible. If it is unchecked the drop list should be Disable/Invisible.

    this is my code for check box:

    <td>
    input type="checkbox" name="districtSelection" onClick=" XXXXXXXXXX">
    <td> Check if you need 2 districts </td>
    </td>

    Code for Drop Downlist:

    <td>Districts </td>
    <td>
    <select name="AppDist">
    <option value="notselected">Select a District</option>
    <!--- Loops through the returned query to populate the select box with congressional districts --->
    <cfoutput query="distList">
    </cfoutput>
    </select>
    </td></tr>

    So, what should be the onclick method in check box and how should I validate this in that methos.

    Could anyone help me this.

    Thankks,
    Cold Fusion Beginner