ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 28th, 2004, 11:56 AM
Codeless Codeless is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 5 Codeless User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 sec
Reputation Power: 0
Need help: editable text fields

i am trying to make an editable text field.

<cfloop from="1" to="#ArrayLen(SESSION.Cart.ItemType)#" index="ThisItem">

<tr bordercolor="#004e82">

<td height="42" class ="style43" width="60"><input type="text" name="ModelNum#ThisItem#" value =" <cfoutput>#SESSION.Cart.ItemModelNum[ThisItem]#</cfoutput>" maxlength = "70" > </td>
<td class ="style43" width="40"> <input type="text" name="CunyTag#ThisItem#" value ="<cfoutput>#SESSION.Cart.CunyTag[ThisItem]#</cfoutput>" maxlength ="15" ></td>
<cfoutput>#form['cunytag#ThisItem#']#</cfoutput>
<td class ="style43" width ="20"><br><input type="text" name="ItemType#ThisItem#" value ="<cfoutput>#SESSION.Cart.ItemType[ThisItem]#</cfoutput>" maxlength ="30"> &nbsp;</td>
<td class ="style43" width ="40"> <input type="text" name="ItemRoomNum#ThisItem#" value ="<cfoutput>#SESSION.Cart.ItemRoomNum[ThisItem]#</cfoutput>">&nbsp;</td>

</tr>


</cfloop>


all the items get stored in session variables, and when i click on update button it should update all the session variables.

<cfelseif IsDefined('FORM.UpdateItem')>
<cfloop from ="1" to="#ArrayLen(SESSION.Cart.ItemType)#" index="ThisItem" >

<cfset SESSION.Cart.ItemModelNum[ThisItem] = #FORM['ModelNum#ThisItem#']#>


</cfloop>

Element ModelNum1 is undefined in a Java object of type class coldfusion.filter.FormScope referenced as

I cant figure out why am getting that error.

Reply With Quote
  #2  
Old December 28th, 2004, 12:00 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
If you do a <cfdump> of the form scope on your action page, do you see the values you expect from the form?
__________________
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

Reply With Quote
  #3  
Old December 28th, 2004, 12:02 PM
Codeless Codeless is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 5 Codeless User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 sec
Reputation Power: 0
Quote:
Originally Posted by kiteless
If you do a <cfdump> of the form scope on your action page, do you see the values you expect from the form?


no am not able to see the exact values
all i see is ModelNum#ThisItem#, so forth
i should see ModelNum1..ModelNum2...etc

Reply With Quote
  #4  
Old December 28th, 2004, 12:31 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
On your form page you need to wrap the loop in <cfoutput> tags in order to output the variables to the screen. Anywhere you want to output CFML variables or function calls to the output buffer you need to wrap in <cfoutput>.

Reply With Quote
  #5  
Old December 28th, 2004, 02:24 PM
Codeless Codeless is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 5 Codeless User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 sec
Reputation Power: 0
thanks

Reply With Quote
  #6  
Old December 28th, 2004, 02:39 PM
glively glively is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 17 glively User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 51 sec
Reputation Power: 0
If you are setting the session variables, then you DO NOT need to put CFOUTPUT around the statements. That is only if you want to output CF variables to the screen.

You need to use #Evaluate (form.Fieldname#counter#)# in order to see the contents of the dynamically built fieldname.

Reply With Quote
  #7  
Old December 28th, 2004, 03:02 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
Actually, using evaluate() is very inefficient and should be avoided as much as possible. Use the array notation instead:

form.["fieldName#counter#"]

Reply With Quote
  #8  
Old December 28th, 2004, 03:18 PM
glively glively is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 17 glively User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 51 sec
Reputation Power: 0
You're right. Evaluate can be slow. I've found only a few places where it's come in handy. Dynamic field names is one of them.

However Codeless was using the dot notation and was not getting the CONTENTS of the field. He was simply getting the correct field name. Not was he was looking for.

Reply With Quote
  #9  
Old December 28th, 2004, 03:28 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
hmmm, I'm a bit confused. If you want the value of the form field, you'd use the array notation like:

#form["myFieldName"]#

And if you have a dynamic field name you can do:

#form["myField#counter#"]

And if you simply wanted to display the field name to the screen you could do:

The field is named: myField#counter#

I'm not sure where you'd want to use evaluate() in this lineup...am I missing something?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Need help: editable text fields


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT