Michael,

Run the following code:

<cfscript>
s1 = structNew();
s1.camelCase = "key is stored in uppercase";

s2 = structNew();
s2["camelCase"] = "key is stored in camel-case";
</cfscript>

<cfdump var="#s1#" label="upper case" />
<br />
<cfdump var="#s2#" label="camel-case" />

<cfwddx action="cfml2js" input="#s1#" toplevelvariable="s1" />
<cfwddx action="cfml2js" input="#s2#" toplevelvariable="s2" />

Notice that CF stores camel-case keys if the brackets are used. In both
cases the keys are converted to lowercase in JavaScript.

Personally, while I use camelcase as well, it simplifies things greatly that
it's all lowercase. It makes things consistent and you don't worry have to
worry about a developer writing code that uses different case typing.
Granted, hopefully we'll all coding under strict guidelines, but that's not
always the case--especially when doing temporary contracting work.

-Dan

>-----Original Message-----
>From: Dawson, Michael [mailto:[EMAIL PROTECTED]
>Sent: Monday, December 19, 2005 5:15 PM
>To: CF-Talk
>Subject: RE: Known Bug in CFWDDX CFML2JS Variable Name Case?
>
>Here is my code.  I'm going to try it the other way now.  It kind of
>sucks because I like to use camel-case in CF, but it looks like I have
>to use lower-case in JS.
>
>I saw the part about the query column names, but I was hoping it was a
>typo.  ;-)
>
>Thanks
>
><cfset object = structNew()>
><cfset object.created = now()>
><cfset object.firstName = "Michael">
><cfset object.lastName = "Dawson">
><cfset object.birthDate = createDate(1967, 9, 25)>
>
><cfset childArray = arrayNew(1)>
><cfset childArray[1] = "Kirstyn">
><cfset childArray[2] = "Kirby">
><cfset childArray[3] = "Colin">
>
><cfset object.children = childArray>
>
><cfwddx action="cfml2js" input="#object#" output="output"
>toplevelvariable="myFamily">
>
>-----Original Message-----
>From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED]
>Sent: Monday, December 19, 2005 3:50 PM
>To: CF-Talk
>Subject: RE: Known Bug in CFWDDX CFML2JS Variable Name Case?
>
>Michael,
>
>What's your CF code look like? Note that CF handles the following
>differently:
>
><cfset struct.keyName = "KEYNAME">
><cfset struct["keyName"] = "keyName">
>
>If you use the dot notation, then CF stores the key in all upper case.
>If you use the bracket notation, CF will keep the case. You can verify
>this using <cfdump />.
>
>Lastly, note that the CFDOCS state that "query column names" maintain
>their case. It doesn't say anything about structures.
>
>-Dan
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227312
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to