ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 24th, 2005, 05:37 PM
masseySlaveNZ masseySlaveNZ is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 2 masseySlaveNZ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 16 sec
Reputation Power: 0
form GET problem.

Hello

I have a rather large script which is processing form data. I didnt want to go through the script using the url.variable name to get each var, as it will probably be changed to post in the future.

So I created a function getval(var), which needs to return the var. (i.e. url.<contents of var passed) needs to be returned).

The problem is I can't get it to work, in CFscript or pure CF, as the only way of getting things from the get string needs to be passed directly. Heres an example of what is not working:

<cffunction name="getval" returntype="string" output="false" >
<cfargument name="variable" required="true" type="string">
<cfset returnVar = "#url.variable#">
<cfreturn returnVar>
</cffunction>

So if I pass in "username" as variable, it needs to return url.username.

The search function for the forum does not seem to be working. Thanks if anyone has a answer for me

Im thinking i will have to do a loop.

Reply With Quote
  #2  
Old May 24th, 2005, 06:24 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,700 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 17 h 45 m 21 sec
Reputation Power: 53
How about:

<cffunction name="getval" returntype="string" output="false" >
<cfargument name="variable" required="true" type="string" />
<cfreturn url[arguments.variable] />
</cffunction>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old May 24th, 2005, 06:42 PM
masseySlaveNZ masseySlaveNZ is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 2 masseySlaveNZ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 16 sec
Reputation Power: 0
No luck unfortunately. it comes up with:

Error Occurred While Processing Request
Element form_type is undefined in a Java object of type class coldfusion.filter.UrlScope referenced as

If i leave the url.[ (the . in) it comes up with:

A CFML variable name cannot end with a "." character.
The variable url. ends with a "." character. You must supply an additional structure key or delete the "." character.

It does not work. I tried it in cfscript with the following aswell:

function getval( variable ) {
return url.[variable];
}

Reply With Quote
  #4  
Old May 24th, 2005, 07:59 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,700 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 17 h 45 m 21 sec
Reputation Power: 53
Not sure what you're doing incorrectly because it works fine for me:

Code:
<cfset url.name = "foo" />

<cffunction name="getVal" returntype="string" output="false" >
<cfargument name="variable" required="true" type="string" />
<cfreturn url[arguments.variable] />
</cffunction>

<cfoutput>#getVal( 'name' )#</cfoutput>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > form GET problem.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT