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:
Dell PowerEdge Servers
  #1  
Old June 18th, 2004, 01:41 AM
A Patel A Patel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 A Patel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Array Structure & Session

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

Reply With Quote
  #2  
Old June 18th, 2004, 09:09 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 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 3 Days 18 h 10 m 11 sec
Reputation Power: 42
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

Reply With Quote
  #3  
Old June 18th, 2004, 10:27 AM
A Patel A Patel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 A Patel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by kiteless
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?

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

Reply With Quote
  #4  
Old June 18th, 2004, 10:29 AM
A Patel A Patel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 A Patel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
infect, I'm toggeling the page for 2 array structure value and i want to retain the value which is submitted.

Reply With Quote
  #5  
Old June 19th, 2004, 03:11 AM
A Patel A Patel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 A Patel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I found the answer

Looks some bug in Coldfusion 5.0. Need some trick

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Array Structure & Session


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





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