|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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"> </td> <td class ="style43" width ="40"> <input type="text" name="ItemRoomNum#ThisItem#" value ="<cfoutput>#SESSION.Cart.ItemRoomNum[ThisItem]#</cfoutput>"> </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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
Quote:
no am not able to see the exact values all i see is ModelNum#ThisItem#, so forth i should see ModelNum1..ModelNum2...etc |
|
#4
|
|||
|
|||
|
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>.
|
|
#5
|
|||
|
|||
|
thanks
|
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
Actually, using evaluate() is very inefficient and should be avoided as much as possible. Use the array notation instead:
form.["fieldName#counter#"] |
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
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? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Need help: editable text fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|