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

How do it get this to work? <cfif parameterexists(evaluate(test)) is true>

<cfif parameterexists(evaluate(test)) is true>


test contains the value (form.126).  Any help would be da bomb.
0
gnosticgnowledge
Asked:
gnosticgnowledge
  • 4
  • 3
1 Solution
 
danrosenthalCommented:
You would do it like this...

<cfif ISDEFINED("#test#")>
      It is defined
</cfif>

BUT, "126" is not a valid variable name and your code will throw an error. Variable names CANNOT start with numbers.
0
 
gnosticgnowledgeAuthor Commented:
form variables cannot be numbers? are you sure?

0
 
gnosticgnowledgeAuthor Commented:
nope.  I made the contents of test =form.x126
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
danrosenthalCommented:
gnostic, you are correct (in your first post).

Here is a way to do it:
<CFSET test = "form[""126""]">

<CFIF ISDEFINED("#evaluate(test)#")>
      It is defined
</cfif>
0
 
danrosenthalCommented:
Disregard last post, this one works:

<CFSET test = "form.126">
<CFIF ISDEFINED("form.fieldnames") AND listfindnocase(form.fieldnames,LISTLAST(test,"."))>
     It is defined: <CFOUTPUT>#evaluate(test)#</CFOUTPUT>
</cfif>
0
 
gnosticgnowledgeAuthor Commented:
Very clever, nice job indeed. Hats off to you.  Not only are you da bomb you are a true master.  

cheers
0
 
danrosenthalCommented:
Thanks!

Dan "Da Bomb" Rosenthal
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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