Problem passing Session variable as URL parameter?

Hi,
I am trying to create a multiple page entry form using
coldfusion session. But I am having some problem when passing the
session variable to url parameter. For test purpose I have created
the following code:
<cfif Not IsDefined("SESSION.AE")>
<!--- If structure undefined, create/initialize it
--->
<cfset SESSION.AE = StructNew()>
<!--- Represent current form srep; start at one --->
<cfset SESSION.AE.StepNum = 1>
</cfif>
<cfif IsDefined("Form.GoBack")>
<cfset SESSION.AE.StepNum = #url.StepNum# - 1>
<cfelseif IsDefined("Form.Next")>
<cfset SESSION.AE.StepNum = #url.StepNum# + 1>
</cfif>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<form method="post"
action="/AE/try.cfm?StepNum=#SESSION.AE.StepNum#">
<input type="submit" name="GoBack" value="Back">
<input type="submit" name="Next" value="Next">
</form>
</body>
</html>
When run it I get the following error:
The value "" cannot be converted to a number
The error occurred in C:\CFusionMX\wwwroot\AE\try.cfm: line
11
9 : <cfset SESSION.AE.StepNum = #url.StepNum# - 1>
10 : <cfelseif IsDefined("Form.Next")>
11 : <cfset SESSION.AE.StepNum = #url.StepNum# + 1>
12 : <!---<cfset SESSION.AE.StepNum = #url.StepNum# +
1>--->
13 : </cfif>
I couldn't figure out where is the problem. Any help is
really appreciated.
Thanks in advance.

You are mixing up your gets and posts aren't you?
You have your form method set to post which creates form
variables not
url variables. So when you try to use the url variable to set
your
session it does not exist.
Change your SESSION.AE.StepNum = #url.StepNum# to
Session.AE.StepNum =
form.StepNum, note there is no need for the #'s.
OR
change your form method="post" to form method="get"
Nagelia wrote:
> Hi,
>
> I am trying to create a multiple page entry form using
coldfusion session. But
> I am having some problem when passing the session
counter to url parameter. For
> test purpose I have created the following code:
>
> <cfif Not IsDefined("SESSION.AE")>
> <!--- If structure undefined, create/initialize it
--->
> <cfset SESSION.AE = StructNew()>
> <!--- Represent current form srep; start at one
--->
> <cfset SESSION.AE.StepNum = 1>
> </cfif>
> <cfif IsDefined("Form.GoBack")>
> <cfset SESSION.AE.StepNum = #url.StepNum# - 1>
> <cfelseif IsDefined("Form.Next")>
> <cfset SESSION.AE.StepNum = #url.StepNum# + 1>
> </cfif>
>
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
> </head>
> <body>
> <form method="post"
action="/AE/try.cfm?StepNum=#SESSION.AE.StepNum#">
> <input type="submit" name="GoBack" value="Back">
> <input type="submit" name="Next" value="Next">
> </form>
> </body>
> </html>
>
> When run it I get the following error:
>
> The value "" cannot be converted to a number
>
>
> The error occurred in C:\CFusionMX\wwwroot\AE\try.cfm:
line 11
>
> 9 : <cfset SESSION.AE.StepNum = #url.StepNum# - 1>
> 10 : <cfelseif IsDefined("Form.Next")>
> 11 : <cfset SESSION.AE.StepNum = #url.StepNum# +
1>
> 12 : <!---<cfset SESSION.AE.StepNum =
#url.StepNum# + 1>--->
> 13 : </cfif>
>
> I couldn't figure out where is the problem. Any help is
really appreciated.
>
> Thanks in advance.
>
>
>
>

Similar Messages

  • How to pass session variable value with GO URL to override session value

    Hi Gurus,
    We have below requirement.Please help us at the earliest.
    How to pass session variable value with GO URL to override session value. ( It is not working after making changes to authentication xml file session init block creation as explained by oracle (Bug No14372679 : which they claim it is fixed in 1.7 version  Ref No :Bug 14372679 : REQUEST VARIABLE NOT OVERRIDING SESSION VARIABLE RUNNING THRU A GO URL )
    Please provide step by step solution.No vague answers.
    I followed below steps mentioned.
    RPD:
    ****-> Created a session variable called STATUS
    -> Create Session Init block called Init_Status with SQL
        select 'ACTIVE' from dual;
    -> Assigned the session variable STATUS to Init block Init_Status
    authenticationschemas.xml:
    Added
    <RequestVariable source="url" type="informational"
    nameInSource="RE_CODE" biVariableName="NQ_SESSION.STATUS"/>
    Report
    Edit column "Contract Status" and added session variable as
    VALUEOF(NQ_SESSION.STATUS)
    URL:
    http://localhost:9704/analytics/saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FQAV%2FTest_Report_By%20Contract%20Status&RE_CODE='EXPIRED'
    Issue:
    When  I run the URL above with parameter EXPIRED, the report still shows for  ACTIVE only. The URL is not making any difference with report.
    Report is picking the default value from RPD session variable init query.
    could you please let me know if I am missing something.

    Hi,
    Check those links might help you.
    Integrating Oracle OBIEE Content using GO URL
    How to set session variables using url variables | OBIEE Blog
    OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
    Thanks,
    Satya

  • Passing Session variable of DATE data type to opaque view filter

    Hi Everyone,
    Can you guys please help me in passing session variable of DATE data type in RPD's physical layer 'opaque view' filter for Oracle database
    I tried following syntax, syntax wise I didn't got getting any error, but at the same time this opaque view is not fetching any records as well. my session variable is "END_DATE" and its value is 1998/12/31:00:00:00(as shown in RPD session windows, datatype is DATETIME)
    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
    WHERE TIME_ID =TO_DATE( 'VALUEOF(NQ_SESSION.END_DATE)','MM/DD/YYYY')
    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
    WHERE TIME_ID = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
    WHERE TRUNC(TIME_ID) = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
    In past, I was able to pass a session variable into a opaque view filter using DATEOF function, but that was in DB2.
    I appreciate your time and help

    Finally, I got right format. here it is
    to_date(substr('valueof(NQ_SESSION.END_DATE)',1,10), 'yyyy-mm-dd')
    and here is the source from where I got this information
    Using OBIEE Session Variables in Select Tables in the Physical Layer

  • Problem with session variable

    Hi,
    After I insert a record into my MS Access database, it seems
    to me that the session variable got destroyed so the next page
    display the session variable as undefined. Has anyone have similar
    problem? If so, how to work around that?
    Thanks.
    Tommy,

    neptunes wrote:
    but its leading to jsp page error...For starters: never, never, ignore errors (exceptions and stacktraces). Those contain very, very, worthful information about the cause of the problem and what exactly went wrong. This way you can easily trackback the problem and solve it.
    If you're unable to think logically and smart so that you can interpret the error yourself, if necessary with help of Google, then post it here. Then we'll tell you about the actual problem and possible soltions.
    At any way:
    iam displaying some data in a table using resultset object,now at the same time iam using to session variable to use the resultset object in my other applications...This already doesn't sound very good. You should never pass expensive resources around like that. You should acquire and close the Connection, (Prepared)Statement and ResultSet in the shortest possible scope. Preferably already in the same method as where you query the data.

  • Page 404 Error when passing Session values through URL

    The current application I'm working on is a 'Targeted Email Communications' application. Bascially, employees at the school at which I'm employed can go in and select services to recieve outage notification emails on.
    The problem I'm discussing in this post has to do with our so called 'Notification Summary Screen.' This screen is basically a report region which displays all outage notifications issued by this application. In the left-most column of this report, I have an edit button that when clicked, redirects the user to the 'Create / Update / Send Screen' with the primary key values passed through the URL. When this happens, all other page items query their values based on the NOTIF_ID passed in through the URL. All of this works fine.
    The problem is, on the Notification Summary Screen, I also have a button labeled 'Create a new notification.' This button redirects the user to the same page as before, except now all of the values are NULL because this outage notification has not yet been created. The problem is, when I try and do this - I get a page 404 not found error. I'm pretty sure it's because my application is getting confused because earlier all of the values were passed in through a URL. For the 'Create New' button, I clear the page cache for this page - and it still does nothing. I am at a loss for what to do here because I keep getting the error.
    Here's the code for the URL button found in the report query in the 'Notification Summary Screen' :
    ('<a href='
              || 'f?p=&APP_ID.:2:&SESSION.::&DEBUG.::'
              || 'P2_NOTIF_ID,P2_NOTIF_SEQ,P2_INFO_TYPE:'
              || a.notif_id ||','|| b.notif_seq || ',' || 'Update'
              || '>'
              || '<img src="#APP_IMAGES#EditButton.gif" />'
              || '</a>') as "edit",** NOTE, I took out the double quotes after href and before the closing right karat brackets because for some reason the code in the URL wouldn't display...weird.... **
    The NOTIF_ID value is the primary key identifier for each outage notification. Additionally, the NOTIF_SEQ value is the sequence number for each (because each notification could have multiple updates). The INFO_TYPE value just references whether this is 'Initial', 'Updated', or 'Closing' information.
    Any suggestions would be much appreciated.
    Eric
    Edited by: user11685190 on Nov 6, 2009 1:12 PM
    Edited by: user11685190 on Nov 6, 2009 1:13 PM
    Edited by: user11685190 on Nov 6, 2009 1:14 PM

    Hey you guys,
    Thanks for your responses. I actually just started working for this academic institution, and have to finish a probationary period before I have access to their VPN (5 Months). Therefore, I cannot access my workspace, nor will they allow me to export my application because it's considered their intellectual property. I believe it may be the &DEBUG portion of it.
    Though I cannot state the exact URL the error states, I can tell you that if I go into application builder to the page in question and try and run it before the page that links to it, I get the error. However, when I use the link everything works fine. When I use the 'Create New' button to link to the page with no values passed, I get the error again. I work again on Monday and will have more information then.
    Thanks again!
    Eric

  • Passing date criteria in url parameter

    Hi,
    I want to filter a recordset by a given date.
    Create the recordset, if I use a runtime value of #27/11/06#
    all the records for that date are returned.
    However, when I try to pass the same information through an
    URL Parameter it doesn't work.
    Is there a problem with passing this info in that way?
    Thanks, Mark.

    No, should be absoloutely fine. The prob is most likely to do
    with your SQL
    statement.
    As a test, don't display any records. At the top of your
    page, try
    outputting the completed SQL statement onto the page to see
    what it looks
    like. The problem being you may need to add the # symbols
    manually. Should
    look something like
    "SELECT * FROM TableName WHERE DateField = #" &
    URLParameter & "#"
    HTH,
    Piers

  • Purchased ColdFusion 10: Having problem with session variables

    My Dept. has just bought CF10 and I'm finally updating my existing web app to CF10 from CF8. My First Problem with CF10 is using session variables.
    When using the lower version of CF (since CF 4 to 8) I have never had any problem setting up session variables and getting or using these variables in other pages after a successful login but with CF 10 it seems setting session variables and using them in other pages are a major problems. I'm not sure where have I done wrong in the codes.
    First I'm setting the session in my Application.cfc This way:
    <cfcomponent displayname="Application" output="true">
      <cfset THIS.Name ="MyNewApp"/>
      <cfset THIS.ApplicationTimeout = CreateTimeSpan(0,0,20,0) />
      <cfset THIS.SessionManagement ="YES"/>
      <cfset THIS.SessionTimeout = CreateTimeSpan( 0, 0, 20, 0 ) />
      <cfset THIS.SetClientCookies = false />
    <cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false">
    <cfset application.Main_DSN = "TESTDB">
    <cfreturn true />
    </cffunction>
    <cffunction name="onApplicationEnd" output="false">
          <cfargument name="applicationScope" required="true">
        </cffunction>
    <cffunction name="OnSessionStart" access="public" returntype="void" output="false" hint="Fires when user session initializes.">
    <cfset session.loggedin = "NO">
    <cfset session.username = "">
    <cfset session.userrights = "">
    <cfset session.usergroup = "">
    </cffunction>
    </cfcomponent>
    After login, user is validated and set values to those session.variables:
    ........user validation codes here......................
    <cfif mylogin NEQ true>
          <cflocation url="/login/login.cfm">
          <cfabort
    <cfelse>
          <cfset session.loggedin="Yes">
          <cfset session.username="#Trim(Form.username)#">
         <CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
         <cfset session.userrights = qUserRights><!--- it's a query --->
        <CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
            <cfloop query="qUserGroup">
               <cfset session.usergroup = user_group>
               <cfbreak>
            </cfloop>
        <!--- ****************** ???????????????????????????????????????????????????????????????????????????
        When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
        But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
        So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values   ****************** --->
       <cfdump var="#session.loggedin#">
       <cfdump var="#session.username#">
       <cfdump var="#session.userright#">
       <cfdump var="#session.usergroup#">
    </cfif>
    In index.cfm, Before Login I got:
    session.loggedin = NO
    session.username = ["empty string"]
    session.userrights = ["empty string"]
    session.usergroup = ["empty string"]
    After a successful Login:
    session.loggedin = NO
    session.username = ["empty string"]
    session.userrights = ["empty string"]
    session.usergroup = ["empty string"]
    Have I done something wrong? These codes work on CF8. Please help.
    I need to mentioned:
    CF10 is in Linux and my web app is under https not http. But these session variables should be shared bentween http and https because some older application are still in http.

    On which page is the following code?
    After login, user is validated and set values to those session.variables:
    ........user validation codes here......................
    <cfif mylogin NEQ true>
          <cflocation url="/login/login.cfm">
          <cfabort
    <cfelse>
          <cfset session.loggedin="Yes">
          <cfset session.username="#Trim(Form.username)#">
         <CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
         <cfset session.userrights = qUserRights><!--- it's a query --->
        <CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
            <cfloop query="qUserGroup">
               <cfset session.usergroup = user_group>
               <cfbreak>
            </cfloop>
        <!--- ****************** ???????????????????????????????????????????????????????????????????????????
        When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
        But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
        So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values   ****************** --->
       <cfdump var="#session.loggedin#">
       <cfdump var="#session.username#">
       <cfdump var="#session.userright#">
       <cfdump var="#session.usergroup#">
    </cfif>

  • Passing Session Variable from PHP to Applet

    I'm trying to pass a session variable from a PHP script to a third party applet. The applet needs to accept the variable as a string into a parameter. I think the htnl has to be dynamically created to turn the session variable into a string for the parameter value. Any suggestions ?

    This is really a PHP question. You might get better results on a PHP forum.

  • How can I pass empty value in URL Parameter

    Hi,
    I am passing different URL parameters to one page, to filter
    the recordset on that page. How can I pass an empty value in the
    URL parameter so that the recordset in unfiltered?
    The URL parameter is based on one field of the database:
    ContentType. So, the link would be to
    default.asp?ContentType=Event
    and then all records that have the ContentType field in the
    DB as Event are displayed. Is it possible to use this system to
    pass an empty parameter so that all records are displayed?
    Thanks
    Ian

    ?ContentType=All
    <% if (ContentType == "All")
    Build recordset w/o filtering
    ASP is rusty, but those are the basics.
    "iandobie" <[email protected]> wrote in
    message
    news:e8im80$q7m$[email protected]..
    > Hi,
    > I am passing different URL parameters to one page, to
    filter the recordset
    > on
    > that page. How can I pass an empty value in the URL
    parameter so that the
    > recordset in unfiltered?
    > The URL parameter is based on one field of the database:
    ContentType. So,
    > the
    > link would be to
    > default.asp?ContentType=Event
    > and then all records that have the ContentType field in
    the DB as Event
    > are
    > displayed. Is it possible to use this system to pass an
    empty parameter so
    > that
    > all records are displayed?
    > Thanks
    > Ian
    >

  • Problem with Session variable initialization block

    Hi,
    I'm getting strange results when using session variables in my repository files.
    I have created session variables as specified in the document which is available at
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/bi_admin/biadmin.html
    The main problem getting with the system session variable (USER) in the select statement.
    My select statement is as follows,
    select ':USER',case when upper(':USER') = 'KUMAR' then 'APR-05' end from Dual
    The problem is while logging into the BI Answers it is allowing all the invalid users to login who does not exist.
    when i remove the quotes and simply use :USER in the select statement it is not allowing the invalid users to login but giving error while displaying the results.
    when i remove the user variable from select statement its giving correct results.
    Can i know what is causing the problem.
    Thanks,
    Kumar.

    Hi DK,
    Check out my post Rowlevel Security?? and see if it helps you.
    Cheers!
    -Joe

  • Problem retrieving Session variables in Flex from Coldfusion

    For about a year I've been using a cfc that allows me to remote call from within Flex to retrieve session-level variables.  I much prefer this to using FlashVars because with the remote call the session values don't show up in the page source.
    This was working fine when I was using an Application.cfm file to manage my Coldfusion pages.  However when I switched to using an Application.cfc file, the cfc stopped working.  Neither the cfc or the cfm file contain any code to manage these session variables (they are set in other pages), so the only real difference seems to be changing from Application.cfm to Application.cfc.
    Any thoughts why?  Thanks.

    Ok, this is resolved.
    The problem seems to have been related to the scope of Application.cfc and Application.cfm.  The directory which contained the cfc files had an Application.cfm controlling the session, while the directory with the pages that included the flex swf files had an Application.cfc file.  Apparently these two don't talk to each other.
    The solution is to use either Application.cfc or Application.cfm files, but not to mix them.  In other words, use either -- but be consistent.

  • Problem accessing session variable from jsp

    Hi!
    I get an error retrieving a session variable from inside a JSP declaration scriptlet....
    Something like this code in a JSP page:
    <%!
    public void funtion1() {
    String parameter1 = session.getAttribute("parameter1");
    %>I have seen that I have available getContextServer() method and from there I could call getAttribute("parameter1") . But the thing is that the attribute I want to retrieve was stored in session by another Jsp page.
    Any solutions are welcome
    Cheers
    Victor

    Appropriately the above is one the reasons also You cannot use JSP implicit objects from the declaration tag. However we can think of a small workaround by passing the reference like the one discussed below
    <%!public void funtion1(HttpSession session) {
    String parameter1 = session.getAttribute("parameter1").toString();
    }%>
    <% funtion1(session);%>Hope that helps :)
    REGARDS,
    RaHuL

  • Problem in session variables

    hi ,
    Is it not correct to assume that ones we close the browser the session losts and all the session variables also?
    Actually i have design an authentication page which takes userid and password from user and supply this to servlet which after authentication sets a variable "validity" in session to true.
    And in every other jsp page first i m checking this variableis true or not if not then i m redirecting it to authentication page with this tag
    <jsp:forward page="authentication.jsp" />
    now if i have authenticated correctly and close browser and try to access other pages directly then browser allows me to access any page and infact when i print "validity" variable from session then it prints true. That means even after closing the browsing session remains.
    I tried to print session id then after opening a new browser it is showing the same browser.
    In web.xml file i have mentioned the session time to 60 minutes . Is it because of this?. If it then how these standard sites sun, yahoo maintains session time out as well as browser dependent session.
    Right now what i have to do is before setting the variable i have reset the variable to null. But wher shud i reset the validity variable . in destroy method?
    manish

    Your problem is not due to session time out in the xml
    file.
    I think whenever you close your browser the session
    does not exists.
    Remember to invalidate the session while logging off.
    It should workThat is not true. The session will exist for as long as the session timout option is set. Although invalidating the session at logoff is a good idea, there is no real method to force people to log off when the leave your site/close the browser.
    There are a couple of possibilities why the session would still be used after a browser is closed, although normal behavior is to create a new one. The main reason is because the cookie on the browser that maintains the jsessionid is not destroyed. This often occurs in browsers like NS 7 with a "quick-load" app running in the taskbar area (next to the clock). These little parts of the application never close, and hold on to browser cache and cookies, so as to make it quicker to open and surf.
    How do you ge around this? I do not know, except perhaps by preventing the session from using cookies for tracking...

  • Problems accessing session variables from a pop-up

    I am working on a webapp and I when I click on a certain button I need to have a pop-up appear that will either prompt a user to enter log-in info if they haven't already, otherwise the pop-up just needs to display a report. Users can navigate around on the main page and select various reports so multiple pop-ups could possibly be opened. When a user logs in I save the login info in session variables, but for some reason whenever I click to have another pop-up open it always says that my session variables are null. Is there a way to have more global session variables so that multiple windows (the pop-ups) can touch session variables? Would there be a way to pass the login info in session variables back to the main page and then pass those session variables back out to each pop-up that opens? Thanks so much.

    Have you got session cookies enabled?
    The most common way to keep track of the session id is via a session cookie.
    This cookie gets shared by all windows of the same browser session.
    You are opening these pop-up windows with window.open?
    Print out the session id <%= session.getId() %> on each page to see if it is the same.
    Cheers,
    evnafets

  • Passing BOUSER variable as a parameter to a DB2 stored procedure

    Hi,
    We have created a stored procedure in DB2, which accepts five parameters.  We have to pass the userrname of the logged-in user as one of the five parameters. We have created a DeskI report based on this stored procedure and we have used @variable('BOUSER') as the value for the concerned parameter.
    But Business Objects passes the string '@variable('BOUSER')' as it is instead of replace the variable with it's value. Does anybody have any idea on passing BO variables as parameters to a report based on stored procedure?

    hi,
    Create an object called 'user' with the following definition
    select:
                username
    where:
               username =@Variable('BOUSER')
    Use this object 'user' as parameter to the storedprocedure.
    Regards,
    Vamsee

Maybe you are looking for

  • Script to stop and start Business Object and its components

    Hi Guru I have installed Business Objects and few of its componenents. Please assist where I can find a proper script to do a clean stop and start of its services. My server is Windows 2008 SP2. Target services to have a scripts are; 1. MySQL server

  • Center channel is

    So the problem is, I have X-Fi ExtremeGamer Fatalty and my center channel is very quite - barely hearable. I've done pretty anything - reinstalled drivers, reinstalled console launcher (now installed those beta drivers and console), gone through vari

  • Archlinux is moving to systemd

    Hello! As far as I know Archlinux is moving now to systemd. Personally I fine with systemd, because I'm using it already. I'm also fine with SysVinit. I use systemd, because a dev told me that the move will likely happen in future and I had to instal

  • Bank Details link under Personal Information is not appearing

    Hi All,     In ESS if I attach a ESS user to any US employee then i am not able to see the link for bank details under Personal Information. I have maintained all the steps like, 1)Services maintained and the link resource is maintained for US . 2) s

  • Dialup jar download error

    Hi, We are seeing an odd occurence. Our dialup users using Java Web Start are unable to download certain jar files if they are a certain size. For example when we deploy our code we need to verify that it will work over a dialup connection. If it doe