Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 369273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:54:14+00:00 2026-05-12T13:54:14+00:00

The Form variable in my form is being passed/retrieved via Session. I have a

  • 0

The Form variable in my form is being passed/retrieved via Session.

I have a troublesome Form variable(formField1) that was NOT DEFINED properly in the Session, but the whole form was put into use. Then this particular Form variable(formField1) was filled and used, trapping it in the Session and throwing an error. I gave a stop gap solution:

 <cfif isDefined("TTsession.filing.formField1")>
       <cfset TTD formField1 = TTsession.filing.formField1>
     <cfelse>
       <cfset TTD formField1 = "0">
     </cfif>

TTsession= name of the Session variable
formField1= name of the erroneous form field.

As a result of which all the forms in which TTsession.filing.formField1 was improperly defined are giving an output of 0.

I do not want this. What I want to do is:

  1. Check Does form variable EXIST in session?
  2. If yes,
    <cfset FormVar1=session.FormVar1>
  3. If no,
    1. KILL THE MISSING form variable in that Session.
    2. re-Define the form variable FormVar1 right here in that Session.
      <cfset FormVar1=session.FormVar1>

I am using CFMX6.1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:54:14+00:00Added an answer on May 12, 2026 at 1:54 pm
    <cfparam name="FormVar1" default="0">
    
    <!--- set overide defaults if in the session --->
    <cfif StructKeyExists( TTsession.filing, "formField1")>
       <cfset FormVar1 = TTsession.filing.formField1>
    </cfif>
    

    I think the problem might be where you have created this session, however if you merely want to set defaults just use cfparam :

     <cfparam name="session.filling.formfield1" type="numeric" default="0">
    

    So if the session var is defined, do nothing. Else define it with the value of zero. All in one line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$_GET variable cannot identify the first array element.: I have passed an array in
I have this question relating to Lucene. I have a form and I get
Hi I have following JavaScript code that I am trying to run. My aim
I'm generating a ton of XML that is to be passed to an API
I have a several input fields in a form each having a unique name.
I'm starting work with PHPUnit with Kohana. My application have many controllers which simply
I'm being stymied by what I thought would be the relatively simple task of
I really like PredicateBuilder . It allows me to build all sorts of queries
In the application there is a default report the user see's listing all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.