Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is there a way to change all url variables to form variables?

New Here ,
Jun 25, 2010 Jun 25, 2010

Is there a way to change or copy all url variables so they are scoped as form variables with one statement?

For example:

<cfset form.var1 = url.var1>

<cfset form.var2 = url.var2>

<cfset form.var3 = url.var3>

Can this be done with one statement?

369
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jun 25, 2010 Jun 25, 2010

Did you try:

<cfset form = url>

OR

<cfset form = duplicate(url)>

I'm not 100% sure you can add to the form scope like that in all versions of CF.

If not, you can work with a thrid variable that you incorperate both form and url variables into.  This is a tecnique common in the Fusebox Framework, I believe.

Translate
Valorous Hero ,
Jun 25, 2010 Jun 25, 2010

Did you try:

<cfset form = url>

OR

<cfset form = duplicate(url)>

I'm not 100% sure you can add to the form scope like that in all versions of CF.

If not, you can work with a thrid variable that you incorperate both form and url variables into.  This is a tecnique common in the Fusebox Framework, I believe.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 25, 2010 Jun 25, 2010
LATEST

I’m using CF 8 - but couldn't get the to work. I used the third variable technique you suggested and it works. Thanks for the help!

Beth

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources