Skip to main content
Participant
June 25, 2010
Answered

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

  • June 25, 2010
  • 1 reply
  • 432 views

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?

    This topic has been closed for replies.
    Correct answer ilssac

    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.

    1 reply

    ilssac
    ilssacCorrect answer
    Inspiring
    June 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.

    minoreAuthor
    Participant
    June 25, 2010

    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