3 Replies - 3012 Views - Last Post: 18 November 2007 - 08:30 AM Rate Topic: -----

#1 sysadmin07  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-November 07

Setting Variables Equal

Post icon  Posted 04 November 2007 - 11:25 AM

Hi everyone! First post.

I'm trying to send a user-entered field from a textbox into two ColdFusion variables. For example, if I have <input name="test"> and I want to set "test2" equal to it, how would I go about doing so?

I've tried the following, but to no avail:

-Form page
-Page name is formtest
-<input name="test">

-Action page (separate CF page, btw)
-<cfset test2 = "#formtest.test#">

Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Setting Variables Equal

#2 wiredwizard  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 76
  • Joined: 07-May 05

Re: Setting Variables Equal

Posted 09 November 2007 - 03:03 AM

your set tag should be

[<cfset test2 = form.test>]

View Postsysadmin07, on 4 Nov, 2007 - 11:25 AM, said:

Hi everyone! First post.

I'm trying to send a user-entered field from a textbox into two ColdFusion variables. For example, if I have <input name="test"> and I want to set "test2" equal to it, how would I go about doing so?

I've tried the following, but to no avail:

-Form page
-Page name is formtest
-<input name="test">

-Action page (separate CF page, btw)
-<cfset test2 = "#formtest.test#">

Thanks.

Was This Post Helpful? 0
  • +
  • -

#3 sysadmin07  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-November 07

Re: Setting Variables Equal

Posted 16 November 2007 - 07:59 PM

Thank you. I ended up using a session variable and setting it equal to that. However, I'm having an issue calling it as a value in one of my textboxes. Here are the relevant chunks of my code on my action page:

<cfset session.test2=form.test>

<input name="test3" value="#session.test2#">
//This part won't work. The session.test2 value can't be called as the initial value of a textbox for some reason. The textbox's value will be shown as the text "#session.test2#" instead of the value stored in session.test2

This post has been edited by sysadmin07: 17 November 2007 - 07:44 PM

Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Setting Variables Equal

Posted 18 November 2007 - 08:30 AM

You need to put a <cfoutput> around the input for it to output the variable in coldfusion.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1