RE: [KCFusion] Client side variable storage
The example you sent me is exactly what I coded. The Person function is my collection and setName function is my Map. The difference is that you don't need to know the names of your properties to get them back out and you can choose to output them as an array or a list. -Original Message- From: Ron Hornbaker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 1:38 PM To: [EMAIL PROTECTED] Subject: RE: [KCFusion] Client side variable storage Bryan, Nice code. Just curious: what's the advantage of this over using JavaScript's built-in custom oop features, available in v4 and higher browsers? It would likely be simpler: http://developer.netscape.com/evangelism/docs/articles/oop-javascript/ -Ron > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On > Behalf Of Bryan LaPlante > Sent: Tuesday, April 30, 2002 8:59 PM > To: KCFusion > Subject: [KCFusion] Client side variable storage > > > Hey all, > I was messing around today and got to thinking how tired I am > of the limited > storage capability on the clients browser. I wrote this little > script that > will store name value pairs like a collection in cf only on the > client side. > I called the file pasted below collection.js and if you have ever used > HashMap in Java you will see the similarity. If any one can use > this here it > is. > > /* > Collection.js > > AUTHOR: > Bryan LaPlante > [EMAIL PROTECTED] > Network Web Applications > http://www.netwebapps.com > > DESCRIPTION: Collection > creates a new collection of name=value pairs and provides methods for > retrieving one or a list of keys or values. > > CREATE A COLLECTION: > myCollection = new Collection(); > > METHODS > myCollection.clear(); // Removes all of the key value pairs > but does not > destroy the collection. > myCollection.put(key,value); //Creates an entry into the collection > myCollection.getValue(key); // does a case sensitive search > for a key in > the collection and returns it's value > myCollection.getValueNoCase(key); // does a case insensitive > search for a > key in the collection and returns it's value > myCollection.getKeyArray(); //returns an array of keys > myCollection.getValueArray(); // returns an array of values > myCollection.getKeyList(delim); //returns a list of keys > myCollection.getValueList(delim); // returns a list of values > > EXAMPLE: > Un comment the code at the bottom of the script to see > an example of how to use the collection. > */ > > function Map(key,val){ > this.key = key; > this.val = val; > } > > function Collection(){ > this.collectionMap = new Array(); > this.clear = clearMap; > this.put = putMap; > this.getValue = getValue; > this.getValueNoCase = getValueNoCase; > this.getKeyArray = getKeyArray; > this.getValueArray = getValueArray; > this.getKeyList = getKeyList; > this.getValueList = getValueList; > } > > function putMap(key,val){ > existingKeys = this.getKeyArray(); > isUniqueKey = true; > > for(i=0; iif(existingKeys[i] == key){ > isUniqueKey = false; > this.collectionMap[i].val=val; > break; >} > } > > if(isUniqueKey){ >this.collectionMap[this.collectionMap.length]= new Map(key,val); > } > } > > function clearMap(){ > this.collectionMap.length=0; > } > > function getValue(key){ > for(i=0; iif(this.collectionMap[i].key == key){ > return this.collectionMap[i].val; >} > } > return null; > } > > function getValueNoCase(key){ > for(i=0; iif(this.collectionMap[i].key.toLowerCase() == key.toLowerCase()){ > return this.collectionMap[i].val; >} > } > return null; > } > > function getKeyArray(){ > keyArray = new Array(); > for(i=0; ikeyArray[keyArray.length]=this.collectionMap[i].key; > } > return keyArray; > } > > function getKeyList(delim){ > keyList = ""; > for(i=0; iif(i == this.collectionMap.length-1){ > delim=""; >} >keyList += (this.collectionMap[i].key + delim); > } > return keyList; > } > > function getValueArray(){ > valueArray = new Array(); > for(i=0; ivalueArray[valueArray.length]=this.collectionMap[i].val; > } > return valueArray; > } > > function getValueList(delim){ > valueList = ""; > for(i=0; iif(i == this.collectionMap.length-1){ > delim=""; >} >valueList += (this.collectionMap[i].val + delim); > } > return valueList; > } > /* > /--- Uncomment this section for > testing /// > > //create the collection > collection = new Collection(); > > // clear the collection > collection.clear(); > > // add name value pairs to the collection > collection.put("bryan","user1"); > collection.put("bruce","user2"); > collection.put("dan","user3"); > > // putting bryan again will update the previous entry's value to user4 > collection.put("bryan","user4"); > > alert(collection.getKeyList(",")); > alert(collection.getValueList("|")); > // get an array of ke
Re: [KCFusion] Client side variable storage
I replied to you yesterday and it never came through - Original Message - From: "Ron Hornbaker" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 01, 2002 1:37 PM Subject: RE: [KCFusion] Client side variable storage Bryan, Nice code. Just curious: what's the advantage of this over using JavaScript's built-in custom oop features, available in v4 and higher browsers? It would likely be simpler: http://developer.netscape.com/evangelism/docs/articles/oop-javascript/ -Ron > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On > Behalf Of Bryan LaPlante > Sent: Tuesday, April 30, 2002 8:59 PM > To: KCFusion > Subject: [KCFusion] Client side variable storage > > > Hey all, > I was messing around today and got to thinking how tired I am > of the limited > storage capability on the clients browser. I wrote this little > script that > will store name value pairs like a collection in cf only on the > client side. > I called the file pasted below collection.js and if you have ever used > HashMap in Java you will see the similarity. If any one can use > this here it > is. > > /* > Collection.js > > AUTHOR: > Bryan LaPlante > [EMAIL PROTECTED] > Network Web Applications > http://www.netwebapps.com > > DESCRIPTION: Collection > creates a new collection of name=value pairs and provides methods for > retrieving one or a list of keys or values. > > CREATE A COLLECTION: > myCollection = new Collection(); > > METHODS > myCollection.clear(); // Removes all of the key value pairs > but does not > destroy the collection. > myCollection.put(key,value); //Creates an entry into the collection > myCollection.getValue(key); // does a case sensitive search > for a key in > the collection and returns it's value > myCollection.getValueNoCase(key); // does a case insensitive > search for a > key in the collection and returns it's value > myCollection.getKeyArray(); //returns an array of keys > myCollection.getValueArray(); // returns an array of values > myCollection.getKeyList(delim); //returns a list of keys > myCollection.getValueList(delim); // returns a list of values > > EXAMPLE: > Un comment the code at the bottom of the script to see > an example of how to use the collection. > */ > > function Map(key,val){ > this.key = key; > this.val = val; > } > > function Collection(){ > this.collectionMap = new Array(); > this.clear = clearMap; > this.put = putMap; > this.getValue = getValue; > this.getValueNoCase = getValueNoCase; > this.getKeyArray = getKeyArray; > this.getValueArray = getValueArray; > this.getKeyList = getKeyList; > this.getValueList = getValueList; > } > > function putMap(key,val){ > existingKeys = this.getKeyArray(); > isUniqueKey = true; > > for(i=0; iif(existingKeys[i] == key){ > isUniqueKey = false; > this.collectionMap[i].val=val; > break; >} > } > > if(isUniqueKey){ >this.collectionMap[this.collectionMap.length]= new Map(key,val); > } > } > > function clearMap(){ > this.collectionMap.length=0; > } > > function getValue(key){ > for(i=0; iif(this.collectionMap[i].key == key){ > return this.collectionMap[i].val; >} > } > return null; > } > > function getValueNoCase(key){ > for(i=0; iif(this.collectionMap[i].key.toLowerCase() == key.toLowerCase()){ > return this.collectionMap[i].val; >} > } > return null; > } > > function getKeyArray(){ > keyArray = new Array(); > for(i=0; ikeyArray[keyArray.length]=this.collectionMap[i].key; > } > return keyArray; > } > > function getKeyList(delim){ > keyList = ""; > for(i=0; iif(i == this.collectionMap.length-1){ > delim=""; >} >keyList += (this.collectionMap[i].key + delim); > } > return keyList; > } > > function getValueArray(){ > valueArray = new Array(); > for(i=0; ivalueArray[valueArray.length]=this.collectionMap[i].val; > } > return valueArray; > } > > function getValueList(delim){ > valueList = ""; > for(i=0; iif(i == this.collectionMap.length-1){ > delim=""; >} >valueList += (this.collectionMap[i].val + delim); > } > return valueList; > } > /* > /--- Uncomment this section for > testing /// > > //create the collection > collection = new Collection(); > > // clear the collection > collection.clear(); > > // add name value pairs to the collection > collection.put("bryan","user1"); > collection.put("bruce","user2"); > collection.put("dan","user3"); > > // putting bryan again will update the previous entry's value to user4 > collection.put("bryan","user4"); > > alert(collection.getKeyList(",")); > alert(collection.getValueList("|")); > // get an array of keys > myKeys = collection.getKeyArray(); > > // get an array of values > myVals = collection.getValueArray(); > > //Output the names and their values into an html list item > document.write(""); > for(c=0; c doc
RE: [KCFusion] Parsing two lists
Yipes; more solutions than I can shake a stick at! I already tried one of those suggested an it worked. I'll try the others with efficiency and code re-use in mind. Thanks a million! Keith Purtell, Web/Network Administrator VantageMed Operations (Kansas City) Email: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ellis, Randy Sent: Thursday, May 02, 2002 12:08 PM To: '[EMAIL PROTECTED]' Subject: RE: [KCFusion] Parsing two lists #ItemQtyArray[variables.Idx]# #ItemArray[variables.Idx]# The Items list and Quantities list do not have the same number of values. -Original Message- From: Keith Purtell [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 02, 2002 11:45 AM To: KCFusion (E-mail) Subject: [KCFusion] Parsing two lists This should be simple but my code keeps failing. I have a form that sends multiple values for the same form field. They arrive at my processing template as two lists; one for the item being ordered and another for quantity. Field name Value -- -- Item Servers,Modems,Printers ItemQty8,6,5 The output I seek is: 8 Servers 6 Modems 5 Printers I can't change the sending form; it's a mixture of CF, HTML and JavaScript that has been declared final. However I'd like assistance with the processing end. Any tips on the easiest way to approach this? Keith Purtell, Web/Network Administrator VantageMed Operations (Kansas City) Email: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
RE: [KCFusion] Parsing two lists
#ItemQtyArray[variables.Idx]# #ItemArray[variables.Idx]# The Items list and Quantities list do not have the same number of values. -Original Message- From: Keith Purtell [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 02, 2002 11:45 AM To: KCFusion (E-mail) Subject: [KCFusion] Parsing two lists This should be simple but my code keeps failing. I have a form that sends multiple values for the same form field. They arrive at my processing template as two lists; one for the item being ordered and another for quantity. Field name Value -- -- Item Servers,Modems,Printers ItemQty8,6,5 The output I seek is: 8 Servers 6 Modems 5 Printers I can't change the sending form; it's a mixture of CF, HTML and JavaScript that has been declared final. However I'd like assistance with the processing end. Any tips on the easiest way to approach this? Keith Purtell, Web/Network Administrator VantageMed Operations (Kansas City) Email: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED] __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
Re: [KCFusion] Parsing two lists
opps nevermind. A. - Original Message - From: "Justin Hansen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 02, 2002 12:02 PM Subject: RE: [KCFusion] Parsing two lists > listLen(form.ItemQty))> > > > #listGetAt(form.ItemQty,i)# #listGetAt(form.Item,i)# > > > > > > Justin Hansen > -- > Uhlig Communications > Web Developer / Programmer > -- > [EMAIL PROTECTED] > 913-754-4273 > -- > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On > Behalf Of Keith Purtell > Sent: Thursday, May 02, 2002 11:45 AM > To: KCFusion (E-mail) > Subject: [KCFusion] Parsing two lists > > > This should be simple but my code keeps failing. I have a form that sends > multiple values for the same form field. They arrive at my processing > template as two lists; one for the item being ordered and another for > quantity. > > Field name Value > -- -- > Item Servers,Modems,Printers > ItemQty8,6,5 > > > The output I seek is: > 8 Servers > 6 Modems > 5 Printers > > I can't change the sending form; it's a mixture of CF, HTML and JavaScript > that has been declared final. However I'd like assistance with the > processing end. Any tips on the easiest way to approach this? > > Keith Purtell, Web/Network Administrator > VantageMed Operations (Kansas City) > Email: [EMAIL PROTECTED] > > CONFIDENTIALITY NOTICE: This email message, including any attachments, is > for the sole use of the intended recipient(s) and may contain confidential > and privileged information. Any unauthorized review, use, disclosure or > distribution is prohibited. If you are not the intended recipient, please > contact the sender by reply email and destroy all copies of the original > message. > > > > __ > The KCFusion.org list and website is hosted by Humankind Systems, Inc. > List Archives http://www.mail-archive.com/cf-list@kcfusion.org > Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] > To Subscribe mailto:[EMAIL PROTECTED] > To Unsubscribe mailto:[EMAIL PROTECTED] > > > > > __ > The KCFusion.org list and website is hosted by Humankind Systems, Inc. > List Archives http://www.mail-archive.com/cf-list@kcfusion.org > Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] > To Subscribe mailto:[EMAIL PROTECTED] > To Unsubscribe mailto:[EMAIL PROTECTED] > __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
Re: [KCFusion] Parsing two lists
Would you be willing to send us a code snippit? I am not quite sure i have a handle on the problem. A. - Original Message - From: "Keith Purtell" <[EMAIL PROTECTED]> To: "KCFusion (E-mail)" <[EMAIL PROTECTED]> Sent: Thursday, May 02, 2002 11:44 AM Subject: [KCFusion] Parsing two lists > This should be simple but my code keeps failing. I have a form that sends > multiple values for the same form field. They arrive at my processing > template as two lists; one for the item being ordered and another for > quantity. > > Field name Value > -- -- > Item Servers,Modems,Printers > ItemQty8,6,5 > > > The output I seek is: > 8 Servers > 6 Modems > 5 Printers > > I can't change the sending form; it's a mixture of CF, HTML and JavaScript > that has been declared final. However I'd like assistance with the > processing end. Any tips on the easiest way to approach this? > > Keith Purtell, Web/Network Administrator > VantageMed Operations (Kansas City) > Email: [EMAIL PROTECTED] > > CONFIDENTIALITY NOTICE: This email message, including any attachments, is > for the sole use of the intended recipient(s) and may contain confidential > and privileged information. Any unauthorized review, use, disclosure or > distribution is prohibited. If you are not the intended recipient, please > contact the sender by reply email and destroy all copies of the original > message. > > > > __ > The KCFusion.org list and website is hosted by Humankind Systems, Inc. > List Archives http://www.mail-archive.com/cf-list@kcfusion.org > Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] > To Subscribe mailto:[EMAIL PROTECTED] > To Unsubscribe mailto:[EMAIL PROTECTED] > __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
RE: [KCFusion] Parsing two lists
#listGetAt(form.ItemQty,i)# #listGetAt(form.Item,i)# Justin Hansen -- Uhlig Communications Web Developer / Programmer -- [EMAIL PROTECTED] 913-754-4273 -- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Keith Purtell Sent: Thursday, May 02, 2002 11:45 AM To: KCFusion (E-mail) Subject: [KCFusion] Parsing two lists This should be simple but my code keeps failing. I have a form that sends multiple values for the same form field. They arrive at my processing template as two lists; one for the item being ordered and another for quantity. Field name Value -- -- Item Servers,Modems,Printers ItemQty8,6,5 The output I seek is: 8 Servers 6 Modems 5 Printers I can't change the sending form; it's a mixture of CF, HTML and JavaScript that has been declared final. However I'd like assistance with the processing end. Any tips on the easiest way to approach this? Keith Purtell, Web/Network Administrator VantageMed Operations (Kansas City) Email: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED] __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]
[KCFusion] Parsing two lists
This should be simple but my code keeps failing. I have a form that sends multiple values for the same form field. They arrive at my processing template as two lists; one for the item being ordered and another for quantity. Field name Value -- -- Item Servers,Modems,Printers ItemQty8,6,5 The output I seek is: 8 Servers 6 Modems 5 Printers I can't change the sending form; it's a mixture of CF, HTML and JavaScript that has been declared final. However I'd like assistance with the processing end. Any tips on the easiest way to approach this? Keith Purtell, Web/Network Administrator VantageMed Operations (Kansas City) Email: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. __ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe mailto:[EMAIL PROTECTED] To Unsubscribe mailto:[EMAIL PROTECTED]