|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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]; } |
|
#4
|
|||
|
|||
|
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> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > form GET problem. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|