|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to develop some session iteration for signup process. When i set the session array of some index, it make other array structure reset.
i'm posting some code here, please take a look if you guys can help me out to overcome the problem. <CFLOCK NAME="Session" TIMEOUT="60" TYPE="Exclusive" throwontimeout="Yes"> <cfif arrayLen(Session.AppraiserSignupInfo) LT fldStateRole> <cfoutput>Entered : #arrayLen(Session.AppraiserSignupInfo)# : #fldLastPage#<br></cfoutput> <cfset mylocalStruct = arrayLen(Session.AppraiserSignupInfo)+1> <CFSET Session.AppraiserSignupInfo[mylocalStruct] = StructNew()> <cfset Session.AppraiserSignupInfo[mylocalStruct].CompanyName = CompanyName> <cfset Session.AppraiserSignupInfo[mylocalStruct].FirstName = FirstName> <cfset Session.AppraiserSignupInfo[mylocalStruct].LastName = LastName> <cfset Session.AppraiserSignupInfo[mylocalStruct].FBEmail = FBEmail> <!---- <cfset ArrayAppend(Session.AppraiserSignupInfo, lStateInfo)> ---> <cfelse> <cfif fldLastPage EQ 2> <cfoutput>Else Loop 2: #fldLastPage# : #CompanyName# : #Session.AppraiserSignupInfo[fldLastPage].CompanyName# <br></cfoutput> <cfset Session.AppraiserSignupInfo[2].CompanyName = CompanyName> <cfset Session.AppraiserSignupInfo[2].FirstName = FirstName> <cfelse> <cfoutput>Else Loop 1: #fldLastPage# : #CompanyName# : #fldLastPage# : #Session.AppraiserSignupInfo[fldLastPage].CompanyName# : Anjan <br></cfoutput> <cfset Session.AppraiserSignupInfo[1].CompanyName = CompanyName> <cfset Session.AppraiserSignupInfo[1].FirstName = FirstName> </cfif> </cfif> </CFLOCK> This block is getting again and again when form post action takes place. Idea is to create the session array & structure to fill data in same form untill users press complete. As i mentioned earlier, when i set value of index 2 structure, it reset all the value in index 1 array. Thanks and advance. A Patel |
|
#2
|
|||
|
|||
|
What is this line doing?
<cfif arrayLen(Session.AppraiserSignupInfo) LT fldStateRole> It's not clear from the code and your explanation what you are trying to do. Can you create a simple example that demonstrates the problem? Or add some comments that explain exactly what the different pieces of this code are intended to do?
__________________
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:
sorry! currently I'm not able to post the sample page as i'm away from my development environment. Let me explain, what exectly I'm doing and looking for: 1) User come to registeration page, I create Array using <cfparam name="Session.AppraiserSignupInfo" type="array" default="#arrayNew(1)#")> 2) if it is first time i add structure to array using following code <cfset mylocalStruct = arrayLen(Session.AppraiserSignupInfo)+1> <CFSET Session.AppraiserSignupInfo[mylocalStruct] = StructNew()> It will alwasy add 1 as i calculate arrayLen(..) 3) I asked user to enter first name & company name. If he want to add another company name and first name he push 1 submit button which will post the page to same page. 4) this time, i used following code <cfif fldLastPage EQ 2> <cfoutput>Else Loop 2: #fldLastPage# : #CompanyName# : #Session.AppraiserSignupInfo[fldLastPage].CompanyName# <br></cfoutput> <cfset Session.AppraiserSignupInfo[2].CompanyName = CompanyName> <cfset Session.AppraiserSignupInfo[2].FirstName = FirstName> <cfelse> <cfoutput>Else Loop 1: #fldLastPage# : #CompanyName# : #fldLastPage# : #Session.AppraiserSignupInfo[fldLastPage].CompanyName# : Anjan <br></cfoutput> <cfset Session.AppraiserSignupInfo[1].CompanyName = CompanyName> <cfset Session.AppraiserSignupInfo[1].FirstName = FirstName> </cfif> </cfif> 5) when i come to this submitted page, i check that do i have structure to support new company name and first name ? If it is not then i call following code: <cfif arrayLen(Session.AppraiserSignupInfo) LT fldStateRole> <cfoutput>Entered : #arrayLen(Session.AppraiserSignupInfo)# : #fldLastPage#<br></cfoutput> <cfset mylocalStruct = arrayLen(Session.AppraiserSignupInfo)+1> <CFSET Session.AppraiserSignupInfo[mylocalStruct] = StructNew()> <cfset Session.AppraiserSignupInfo[mylocalStruct].CompanyName = CompanyName> <cfset Session.AppraiserSignupInfo[mylocalStruct].FirstName = FirstName> <cfset Session.AppraiserSignupInfo[mylocalStruct].LastName = LastName> <cfset Session.AppraiserSignupInfo[mylocalStruct].FBEmail = FBEmail> 6) Now when i submit the page for first array index ( [1] ), it wipe out array'[2]'s value. 7) when i submit the page for second array index ([2], it wipe out array[1]'s value. I hope this will help you to identiry the problem. thanks for your help in advance. A Patel |
|
#4
|
|||
|
|||
|
infect, I'm toggeling the page for 2 array structure value and i want to retain the value which is submitted.
|
|
#5
|
|||
|
|||
|
I found the answer
Looks some bug in Coldfusion 5.0. Need some trick
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Array Structure & Session |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|