RE: Variable names in CFINPUT

2002-04-27 Thread Dave Watts

 Which of these is best?
 1.
 cfset x = getValues[colname][rownum]
 CFINPUT Name=#x# value=#DefaultValue#
 
 2.
 cfset x = #x#+1
 CFINPUT Name=#getValues.ColName##x# value=#DefaultValue#
 
 3.
 CFINPUT Name=#getValues[colname][rownum]# value=#DefaultValue#

Considering that (1) and (3) will do one thing, and (2) will do something
else, I don't know - it depends on what you're trying to do.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-27 Thread Dave Watts

  cfset x = getValues[colname][rownum]
 
 This'll work with Access? 

Since it's referring to a recordset, or Query object, in CF, the source of
that Query object is irrelevant. Yes, it'll work with Access, in that sense.

 I've been reading that evaluate is a bad idea, but 
 I'm still not clear on what to do instead - if you 
 could explain it, or suggest a webpage, it'd be great.

Use Evaluate when you've got a string, and you want to treat that string as
an expression and evaluate it. If there's any way you can avoid using
Evaluate, by referencing a variable using array syntax, do so.

For example, let's say you've got a form. In the action page, you might not
know what form variables exist exactly - perhaps your action page can handle
any number of variables within the form based on a naming scheme within the
form. In your form, you might have something like this:

input type=text name=Name1 ...
input type=text name=Name2 ...
..
input type=text name=Name42

In your action page, you might want to do something with each of these
variables, but you might not know ahead of time how many there are - perhaps
the form itself is dynamically generated. So, in your action page, you might
loop from 1 to N, where N is the maximum number of form fields (perhaps N is
discovered through another form field):

cfloop index=i from=1 to=#Form.NumberOfNames#
cfset ThisName = Evaluate(Form.Name  i)
... 
/cfloop

In the above example, you're building a string with Form.Name and the
number in the index counter. Then, you're evaluating that string, which
returns the value of the expression Form.Name1 or Form.Name42 based on the
current index value. However, Ray's point is that, because the Form scope is
a structure - and because structures can be enumerated and their members can
be referenced by array syntax - you don't have to use Evaluate:

cfloop index=i from=1 to=#Form.NumberOfNames#
cfset ThisName = Form[Name  i]
... 
/cfloop

Because taking a string and evaluating it is a relatively expensive
operation, in CF or most other languages I'd expect, it's best to avoid it
whenever possible.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Adrian Lynch

post more of your code please

Ade

-Original Message-
From: Thane Sherrington [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 17:12
To: CF-Talk
Subject: Variable names in CFINPUT


When using CFINPUT, is it possible to do something like this?

CFINPUT Name=#VariableName# value=#DefaultValue#

When I try, I get an error about duplicate names in CFFORM.

T


__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Timothy Heald

Can we see the template that's producing the error?

Tim Heald
ACP/CCFD :)
Application Development
www.schoollink.net 

 -Original Message-
 From: Thane Sherrington [mailto:[EMAIL PROTECTED]]
 Sent: Friday, April 26, 2002 12:12 PM
 To: CF-Talk
 Subject: Variable names in CFINPUT
 
 
 When using CFINPUT, is it possible to do something like this?
 
 CFINPUT Name=#VariableName# value=#DefaultValue#
 
 When I try, I get an error about duplicate names in CFFORM.
 
 T
 
 
__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Andy Ewings

Yep you can do this but what appears to be happening is that you are
creating 2 form controls with the same name (i.e. #VariableName# - make sure
they are all unique

-Original Message-
From: Adrian Lynch [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 17:16
To: CF-Talk
Subject: RE: Variable names in CFINPUT


post more of your code please

Ade

-Original Message-
From: Thane Sherrington [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 17:12
To: CF-Talk
Subject: Variable names in CFINPUT


When using CFINPUT, is it possible to do something like this?

CFINPUT Name=#VariableName# value=#DefaultValue#

When I try, I get an error about duplicate names in CFFORM.

T



__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Thane Sherrington

At 05:16 PM 4/26/02 +0100, Adrian Lynch wrote:
post more of your code please

I'll have to get it from home.  Basically, I have a set of variable names 
and values that I get from a query.

So it's something like this:

CFQUERY name=GetFields datasource=#dsn#
 SELECT FieldName
 FROM Fields
 WHERE TableID=#TableID#
/CFQUERY

CFLOOP Query=GetFields
 CFQUERY name=GetValues datasource=#dsn#
 SELECT #GetFields.FieldName#
 FROM #TableName#
 WHERE ID=#ID#
 /CFQUERY
 CFSET DefaultValue=evaluate(GetValues.#GetFields.FieldName#)
 CFINPUT Name=#GetFields.FieldName# value=#DefaultValue#
/CFLOOP

I'd like it to loop through the inputs and create a form, but it gives the 
error about duplicate names, even though the names are different (though 
the variable name is the same.)

T

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Adrian Lynch

take it out of the cfinput and see what it's producing

-Original Message-
From: Thane Sherrington [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 17:33
To: CF-Talk
Subject: RE: Variable names in CFINPUT


At 05:16 PM 4/26/02 +0100, Adrian Lynch wrote:
post more of your code please

I'll have to get it from home.  Basically, I have a set of variable names 
and values that I get from a query.

So it's something like this:

CFQUERY name=GetFields datasource=#dsn#
 SELECT FieldName
 FROM Fields
 WHERE TableID=#TableID#
/CFQUERY

CFLOOP Query=GetFields
 CFQUERY name=GetValues datasource=#dsn#
 SELECT #GetFields.FieldName#
 FROM #TableName#
 WHERE ID=#ID#
 /CFQUERY
 CFSET DefaultValue=evaluate(GetValues.#GetFields.FieldName#)
 CFINPUT Name=#GetFields.FieldName#
value=#DefaultValue#
/CFLOOP

I'd like it to loop through the inputs and create a form, but it gives the 
error about duplicate names, even though the names are different (though 
the variable name is the same.)

T


__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Andy Ewings

If you output #GetFields.FieldName# for each iteration of the loop you will
undoubtedly find that two or more values are the same, which you can't have
if you are using this to name form controls

-Original Message-
From: Adrian Lynch [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 17:47
To: CF-Talk
Subject: RE: Variable names in CFINPUT


take it out of the cfinput and see what it's producing

-Original Message-
From: Thane Sherrington [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 17:33
To: CF-Talk
Subject: RE: Variable names in CFINPUT


At 05:16 PM 4/26/02 +0100, Adrian Lynch wrote:
post more of your code please

I'll have to get it from home.  Basically, I have a set of variable names 
and values that I get from a query.

So it's something like this:

CFQUERY name=GetFields datasource=#dsn#
 SELECT FieldName
 FROM Fields
 WHERE TableID=#TableID#
/CFQUERY

CFLOOP Query=GetFields
 CFQUERY name=GetValues datasource=#dsn#
 SELECT #GetFields.FieldName#
 FROM #TableName#
 WHERE ID=#ID#
 /CFQUERY
 CFSET DefaultValue=evaluate(GetValues.#GetFields.FieldName#)
 CFINPUT Name=#GetFields.FieldName#
value=#DefaultValue#
/CFLOOP

I'd like it to loop through the inputs and create a form, but it gives the 
error about duplicate names, even though the names are different (though 
the variable name is the same.)

T



__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread David DiPietro

Add a counter
cfset i = 0
CFLOOP Query=GetFields
cfset i = #1#+1
 CFQUERY name=GetValues datasource=#dsn#
 SELECT #GetFields.FieldName#
 FROM #TableName#
 WHERE ID=#ID#
 /CFQUERY
 CFSET DefaultValue=evaluate(GetValues.#GetFields.FieldName#)
 CFINPUT Name=#GetFields.FieldName##i# value=#DefaultValue#
/CFLOOP

David DiPietro
Systems Developer / Engineer
OSU College of Medicine  Public Health
Voice (614) 292-5960
Fax (614) 292-0745


-Original Message-
From: Adrian Lynch [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 12:47 PM
To: CF-Talk
Subject: RE: Variable names in CFINPUT


take it out of the cfinput and see what it's producing

-Original Message-
From: Thane Sherrington [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 17:33
To: CF-Talk
Subject: RE: Variable names in CFINPUT


At 05:16 PM 4/26/02 +0100, Adrian Lynch wrote:
post more of your code please

I'll have to get it from home.  Basically, I have a set of variable names 
and values that I get from a query.

So it's something like this:

CFQUERY name=GetFields datasource=#dsn#
 SELECT FieldName
 FROM Fields
 WHERE TableID=#TableID#
/CFQUERY

CFLOOP Query=GetFields
 CFQUERY name=GetValues datasource=#dsn#
 SELECT #GetFields.FieldName#
 FROM #TableName#
 WHERE ID=#ID#
 /CFQUERY
 CFSET DefaultValue=evaluate(GetValues.#GetFields.FieldName#)
 CFINPUT Name=#GetFields.FieldName#
value=#DefaultValue#
/CFLOOP

I'd like it to loop through the inputs and create a form, but it gives the 
error about duplicate names, even though the names are different (though 
the variable name is the same.)

T



__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Raymond Camden

 Add a counter
 cfset i = 0
 CFLOOP Query=GetFields
   cfset i = #1#+1
  CFQUERY name=GetValues datasource=#dsn#
  SELECT #GetFields.FieldName#
  FROM #TableName#
  WHERE ID=#ID#
  /CFQUERY
  CFSET 
 DefaultValue=evaluate(GetValues.#GetFields.FieldName#)

Oops, no - time for the evaluate police. To get a dynamic column/row
from a query, just do:

cfset x = getValues[colname][rownum]

  CFINPUT Name=#GetFields.FieldName##i# 
 value=#DefaultValue#
 /CFLOOP
 


===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread David DiPietro

cfset x = getValues[colname][rownum]
CFINPUT Name=#x# value=#DefaultValue#
Help me out.  I don't get it.
Why isn't this an evaluative action?


David DiPietro
Systems Developer / Engineer
OSU College of Medicine  Public Health
Voice (614) 292-5960
Fax (614) 292-0745


-Original Message-
From: Raymond Camden [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 2:12 PM
To: CF-Talk
Subject: RE: Variable names in CFINPUT


 Add a counter
 cfset i = 0
 CFLOOP Query=GetFields
   cfset i = #1#+1
  CFQUERY name=GetValues datasource=#dsn#
  SELECT #GetFields.FieldName#
  FROM #TableName#
  WHERE ID=#ID#
  /CFQUERY
  CFSET
 DefaultValue=evaluate(GetValues.#GetFields.FieldName#)

Oops, no - time for the evaluate police. To get a dynamic column/row
from a query, just do:

cfset x = getValues[colname][rownum]

  CFINPUT Name=#GetFields.FieldName##i#
 value=#DefaultValue#
 /CFLOOP



===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda


__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Dave Watts

 cfset x = getValues[colname][rownum]
 CFINPUT Name=#x# value=#DefaultValue#
 Help me out.  I don't get it.
 Why isn't this an evaluative action?

In the strictest sense, it is - you're evaluating a variable to get a value.
However, what Ray is referring to is the use of the Evaluate function, which
takes a string, and evaluates this string as if it were an expression. This
string evaluation done with Evaluate is relatively expensive, and in this
case, unnecessary.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread Thane Sherrington

At 02:11 PM 4/26/02 -0400, Raymond Camden wrote:

cfset x = getValues[colname][rownum]

This'll work with Access?  I've been reading that evaluate is a bad idea, 
but I'm still not clear on what to do instead - if you could explain it, or 
suggest a webpage, it'd be great.

T

__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread David DiPietro

Thanks

David DiPietro
Systems Developer / Engineer
OSU College of Medicine  Public Health
Voice (614) 292-5960
Fax (614) 292-0745


-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 2:45 PM
To: CF-Talk
Subject: RE: Variable names in CFINPUT


 cfset x = getValues[colname][rownum]
 CFINPUT Name=#x# value=#DefaultValue#
 Help me out.  I don't get it.
 Why isn't this an evaluative action?

In the strictest sense, it is - you're evaluating a variable to get a value.
However, what Ray is referring to is the use of the Evaluate function, which
takes a string, and evaluates this string as if it were an expression. This
string evaluation done with Evaluate is relatively expensive, and in this
case, unnecessary.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444


__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Variable names in CFINPUT

2002-04-26 Thread David DiPietro

Which of these is best?
1.
cfset x = getValues[colname][rownum]
CFINPUT Name=#x# value=#DefaultValue#

2.
cfset x = #x#+1
CFINPUT Name=#getValues.ColName##x# value=#DefaultValue#

3.
CFINPUT Name=#getValues[colname][rownum]# value=#DefaultValue#



David DiPietro
Systems Developer / Engineer
OSU College of Medicine  Public Health
Voice (614) 292-5960
Fax (614) 292-0745


-Original Message-
From: David DiPietro [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 3:29 PM
To: CF-Talk
Subject: RE: Variable names in CFINPUT


Thanks

David DiPietro
Systems Developer / Engineer
OSU College of Medicine  Public Health
Voice (614) 292-5960
Fax (614) 292-0745


-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 2:45 PM
To: CF-Talk
Subject: RE: Variable names in CFINPUT


 cfset x = getValues[colname][rownum]
 CFINPUT Name=#x# value=#DefaultValue#
 Help me out.  I don't get it.
 Why isn't this an evaluative action?

In the strictest sense, it is - you're evaluating a variable to get a value.
However, what Ray is referring to is the use of the Evaluate function, which
takes a string, and evaluates this string as if it were an expression. This
string evaluation done with Evaluate is relatively expensive, and in this
case, unnecessary.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444



__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists