|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
<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. |
|
#3
|
|||
|
|||
|
Cheers!!!!
Thanks ![]() Batty |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
thanks for keeping this thread alive. i was spinning my wheels until i saw this
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Getting values of dynamic form fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|