• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

Coldfusion isDefined function problem

I have form name 123.

When I submit the form I am using isDefined but it through the error

Parameter 1 of function IsDefined, which is now form.123, must be a syntactically valid variable name.

Here is how I am using it

if (isDefined("form.#ID#")) {

where ID will be 123
0
erikTsomik
Asked:
erikTsomik
  • 2
  • 2
1 Solution
 
gdemariaCommented:
I think the problem is that the variable has to start with a letter, not a number:   form.X123

The isDefined() statement looks correct.

Another way to do it, without using isDefined() would be ...

<cfif structKeyExists(form,ID)>
    ....

But I think you still have to change the variable name..

0
 
erikTsomikSystem Architect, CF programmer Author Commented:
well it works once it is defined
0
 
erikTsomikSystem Architect, CF programmer Author Commented:
Struct KeyExists works. Thank you
0
 
gdemariaCommented:
Glad it worked, but I do suggest changing the variable name so you don't run into more problems.

I verified from the CF documentation that you need to start with a character, not a number
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now