[thelist] Select - forms

.jeff jeff at members.evolt.org
Mon Mar 10 11:47:01 CST 2003


andrew,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Andrew
>
> well that article made no sense :(
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

sorry to hear that.  do you have some feedback, comments, or questions about
it so that i might write one that's more clear?

<tip type="ColdFusion" author=".jeff">

versions 5 and earlier have a bug that results in url variables declared
multiple times to only result in a single value rather than a list of
values.  this has been fixed in cfmx.  for example:

?foo=bar&foo=far&foo=boo

url.foo should equal bar,far,boo.  in cfmx it is.  in cf5 it will equal the
last value of the last variable it encounters boo.

for versions prior to mx, the following code should fix that:

<cfscript>
  urlData = ListToArray(cgi.query_string, '&');
  StructClear(url);
  for(i = 1; i LTE ArrayLen(urlData); i = i + 1)
  {
    name = URLDecode(ListFirst(urlData[i], '='));
    value = URLDecode(ListLast(urlData[i], '='));
    if(NOT StructKeyExists(url, name))
      url[name] = value;
    else
      url[name] = ListAppend(url[name], value);
  }
</cfscript>

</tip>

.jeff

http://evolt.org/

NOTICE:  members.evolt.org web and email address are changing!
---------------------------------------------------------------------
| OLD:                            | NEW:                            |
| jeff at members.evolt.org          | evolt at jeffhowden.com            |
| http://members.evolt.org/jeff/  | http://evolt.jeffhowden.com/    |
---------------------------------------------------------------------





More information about the thelist mailing list