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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 18th, 2003, 10:36 PM
batgrrrl batgrrrl is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 4 batgrrrl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Getting values of dynamic form fields

I'm new to CF and need some advice.

I have a form that has dynamically created input boxes from a javascript function. They are named txtInput1, txtInput2 etc.

Could someone please tell me how I can use the following code correctly:

<cfif #form.noOfInputs# GTE "0">
<cfloop from="1" to="#form.noOfInputs#" index="i">
<cfoutput>
#i# : #form.txtInput[i]#</cfoutput>
</cfloop>
</cfif>

(note, noOfInputs is usually around 5)

The first #i# displays correctly but the #form.txtInput[i]# errors with

An error occurred while evaluating the expression:
#form.txtInput[i]#
Error near line 49, column 23.
--------------------------------------------------------------------------------
Error resolving parameter FORM.TXTINPUT

Can someone please tell me how I can dynamically call the form names?

Thank you
BatGrrrL

Reply With Quote
  #2  
Old August 19th, 2003, 10:27 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 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 10 h 6 m 34 sec
Reputation Power: 53
<cfif #form.noOfInputs# GTE "0">
<cfloop from="1" to="#form.noOfInputs#" index="i">
<cfoutput>
#i# : #evaluate( 'form.txtInput#i#' )#</cfoutput>
</cfloop>
</cfif>

should work if they are named 'txtInput1', 'txtInput2', etc.

Reply With Quote
  #3  
Old August 19th, 2003, 10:03 PM
batgrrrl batgrrrl is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 4 batgrrrl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

Cheers!!!!

Thanks

Batty

Reply With Quote
  #4  
Old November 27th, 2003, 06:38 PM
cfcentral cfcentral is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 cfcentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Evaluate() is pretty hungry

Code:
<cfif form.noOfInputs> 
<cfloop from="1" to="#form.noOfInputs#" index="i"> 
<cfoutput> 
#i# : #form["txtInput#i#"]#</cfoutput> 
</cfloop> 
</cfif> 


would be a better bet

Reply With Quote
  #5  
Old November 28th, 2003, 11:11 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 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 10 h 6 m 34 sec
Reputation Power: 53
Quote:
Originally posted by cfcentral
Evaluate() is pretty hungry

Code:
<cfif form.noOfInputs> 
<cfloop from="1" to="#form.noOfInputs#" index="i"> 
<cfoutput> 
#i# : #form["txtInput#i#"]#</cfoutput> 
</cfloop> 
</cfif> 


would be a better bet
Hey! You learn something new every day, I'd never tried it like that before. Thanks.

Reply With Quote
  #6  
Old August 26th, 2004, 11:58 AM
alinnane alinnane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 9 alinnane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
looking for a that "Create boxes" javascript

Hi I'm looking for a javascript that
dynamically creates input boxes /textboxes by a javascript function and names tham txtInput1, txtInput2 etc
Can/Will you help
Ideally these new objects would be added to a table.

Searched the web and this is the closed Iv come up with ... not good enough to modify it do as i want to do.

Regards
A newbe to WebDev

Reply With Quote
  #7  
Old August 26th, 2004, 01:00 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 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 10 h 6 m 34 sec
Reputation Power: 53
I'm not convinced that having Javascript generate the names of your form fields is a good idea. People can turn off Javascript and this would break the whole application. Why not just let the server dynamically generate the form field names prior to returning the web page to the user?
__________________
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
  #8  
Old September 14th, 2004, 03:03 PM
hdogg hdogg is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 hdogg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wink thanks for this post

thanks for keeping this thread alive. i was spinning my wheels until i saw this

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Getting values of dynamic form 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