ColdFusion 11: cfclient in the context of the CFML language, not the tooling

G'day:
I am reposting this from my blog ("ColdFusion 11: <cfclient> in the context of the CFML language, not the tooling") at the suggestion of Adobe support:
@dacCfml @ColdFusion Can you post your queries at http://t.co/8UF4uCajTC for all cfclient and mobile queries.— Anit Kumar Panda (@anitkumar85) April 29, 2014
I have edited this in places to remove language that will be deemed inappropriate by the censors here. Changes I have made are in [square brackets]. The forums software here has broken some of the styling, but so be it. There is worthwhile discussion in the comments of the article on my blog: perhaps go have a read.
G'day:
This article could end up being a complete waste of space, as I am operating under more real-world re-interpretation of the raison d'être of <cfclient>, as described by Ram:
ColdFusion [11] has added support for client side CFML (<cfclient>) and this code is translated to JavaScript
Mike Henke has pointed out that the first part of this "CF11 has added support for client-side CFML" is actually ******** (my wording, not his):
"ColdFusion Splendor has added support for client side CFML" is probably phrased wrong and gave me flash backs to VBScript or CFML running in the client browser.
Maybe this is better verbiage. "ColdFusion Splendor has added support for CFML to generate JS".
Because... there's not such thing as "client-side CFML". That would imply CFML actually running on the client (ie: the browser, or the mobile device, as is the target of <cfclient> as a concept). This is absolutely not true. I know Ram went on to qualify what he meant there, but the messaging from Adobe on <cfclient> has been inaccurate. Possibly I think to the point of actual misrepresentation (in the legal sense, I mean).
What <cfclient> does is... convert CFML code to JavaScript. So let's look at that idea.
Why I say this article could be a complete waste of space is that I dunno if this is the intent of <cfclient>; because, really, the messaging from Adobe as to what <cfclient> is for is very muddied. In general the narrative about it is bundled-in with various features of ColdFusion Builder 3.0, in regards to mobile application creation and packaging (and debugging, and all sort of stuff that sounds quite nice but I don't care about as I don't use CFB).
However <cfclient> has to stand on its own merit in the CFML language, completely decoupled from CFB features. And as far as I can tell, Mike is right: as far as CFML goes, <cfclient> is a tag which tells ColdFusion to - instead of compiling to byte code - compiles the enclosed CFML code to JavaScript instead.
This of course just sets my alarm klaxons going.  Because Adobe are (I choose my words carefully) [not very good] at converting CFML to client-side code. This has been borne out by <cfform>, <cflayout>, <cfpod> etc. Back in the days of CFMX7 the "CFML-to-client-side" wizards had some merit, because the client-side arena was still immature, and the team at Macromedia actually had some exposure to the idea of "website development", so they knew where the pain points were that they could possible ameliorate. Times have changed, and the client-side of things is probably now more mature an environment than CFML is - Javascript is probably are more coherent language than CFML is, now - and it is very very very clear that the current Adobe ColdFusion Team don't know the first thing about web development (they can't even write decent CFML for their own documentation, before we get onto how they'd be doing web work!), so they are completely out of their depth when it comes to addressing pain points that web devs might have these days. Not only have they not walked a mile in a web dev's shoes, they don't even - as far as I can tell - know what shoes are, or why someone would be wearing them.
And <cfclient> is a far more "meta" solution than <cfform> or <cfpod> were... at least the CFML-to-client-side solution there had a tangible target in mind. <cfclient> has removed the targets, and is just a tag designed for converting general CFML to general JS. Yikes.
600-odd words in, here's some code. This is the first-ever code I have written using <cfclient>:
<cfclient> <cfset msg = "G'day World"> <cfoutput>#message#</cfoutput> </cfclient>
So I'm off to a false start: I admit I'm sitting in the pub and I've had a few pints (probably four, I guess; this is "having some drinks before deciding to actually drink this evening" sort of level for me), and I inadvertently [messed-up] my variable names here. And this did not yield a compile error. The error just fell through to JS, where it did error
Uncaught ReferenceError: message is not defined gdayWorld.cfm:4
If, in contrast, I tried this in CoffeeScript, I'd get this:
coffee> msg = "G'day world"
'G\'day world'
coffee> alert msg
undefined
coffee>
alert message
ReferenceError: message is not defined
    at eval (eval at  (http://larryng.github.io/coffeescript-repl/js/main.js:96:26), :1:9)
Important note: I know nothing about CoffeeScript - it seems like a solution to a non-existent problem to me - so I just googled "hello world coffeescript" and REPLed the code on http://larryng.github.io/coffeescript-repl/.
The point is here is that ColdFusion, during the "compile" process should actually notice I am referencing a variable that doesn't exist. I'm OK with this being a runtime error in the normal CFML-compile process, because there could be many moving parts (and other files) involved in the runtime environment, but I don't think this is a valid notion with <cfclient>? Or maybe it is?
Update:As Ray points out and Aaron agrees with below: I was being unduly harsh here... it's entirely reasonable for variables to be declared in other JS code elsewhere in the response.
Anyway, once I actually write my code properly, I get this:
G'day World
On the screen. What CF actually sends back in the response is this:
<script type="text/javascript" src="/CFIDE/cfclient/cfclient_main.js"></script> <script type="text/javascript" src="/CFIDE/cfclient/cffunctions.js"></script> <meta name="viewport" content="width=device-width"> <script type='text/javascript'>globalDivStruct=null;var _$gdayWorld_func=function(){var self=this;var variables={};self.__init=function(){var localdivstruct=globalDivStruct;var __output_var="";var tmpVarArray={};message="G'day World";localdivstruct.outputvar+=message;return""}}; function __startPage__$gdayWorld(){document.write("\x3cdiv id\x3d'__cfclient_0'\x3e\x3c/div\x3e");window.ispgbuild=false;var clientDivStruct={divId:"__cfclient_0",outputvar:""};globalDivStruct=clientDivStruct;try{_$gdayWorld=new _$gdayWorld_func;_$gdayWorld.__init()}catch(__eArg){if(__eArg!=="$$$cfclient_abort$$$")throw __eArg;}__$cf.__flush(clientDivStruct)}__startPage__$gdayWorld(); </script>
[Blimey]. To output a string variable? Really? That's what you compile my CFML down to?
Gobsmacked.
And [forget] emotive things like "gobsmacked"... if one looks at the size of the response, it's 128kB to represent "G'day World" on the screen. 128kB might not be a great deal these days when it comes to a web page, but when it comes to rendering "G'day world", it's lunacy. And on a mobile phone - which intrinsically might be in an area in which one is paying a premium for data - it's just irresponsible. This is before we get to the point that it seriously should not take 128kB of data to render 11 bytes.
Blimey. To be honest I was gonna try some more tricky CFML and see how it compiled, but I've run out of will to live (and I have to concede the beer is getting the better of me, and my laptop battery is almost dead). I'll continue this, but I will let this article stand or fall on its own merit; something <cfclient> certainly seems to be unable to do, thusfar.
I'll be back on the case with this tomorrow.
Adam

The functions defined in the cffunctions.js are not namespaced. If it is namespaced, you would have to add the namespace while using a function inside cfclient.
These functions are not namespaced, so that you can use the same syntax for using a function inside and outside the cfclient block.
This is indicative of everyone's concern that you guys would just implement / encourage poor practice in your <cfclient> implementation.
How is it - given you're "compiling" the CFML anyway - you cannot translate source code that says "listlen()" into "compiled" JS that is CF.listLen() or something? Thus good CFML can be translated into good JS.
You seem to think that there's a one-to-one mapping between what the CFML says and what the resultant JS needs to be.
You've basically written a mechanism for a CFML developer to write bad JavaScript.
Well done.
Adam

Similar Messages

  • RFC Error:The BW IDoc type ZSBA011 is not the same as the source system

    Hi Experts,
    RSA1&#61664;Source System &#61664;(Context Menu) Check
    I am getting the below error
    <b>‘The BW IDoc type ZSBA011 is not the same as the source system  IDoc type ZSBD012 ‘              </b>                              
    What might happened wrong.When i checked with my Basis Consultant who is new to job,Replied every this is ok with regeards to RFC.
    Where should i check to correct the error
    Thanks

    Hi,
    Did you do a system copy for BW ?
    Try a restore (rightclick on your source system) in most cases this will solve the problem.
    If not check the notes below:
    184322  Procedure after DB copy of BW source systems 
    886102      System Landscape Copy for SAP BW 2.X, 3.X and NW2004s BI
    325470      Activities after client copy in BW source systems
    325525      Copying and renaming systems in a BW environment
    184754      Procedure after BW database copy
    184447      Building a BW-system landscape
    184971      Notes on BW source system connections
    140276      Error in source system assignment
    524554      Storing destinations in the BW environment
    538052  Maintenance of Myself destination in BW
    Regards, Patrick Rieken
    Message was edited by:
            Patrick Rieken - BI-Formance B.V.

  • TS1389 Trying to play purchased TV series to my Apple TV, I am requested to authorise the computer.  This has already been done and I have tried the suggestions regarding authorisation.  I can play the programs on my computer, but not the Apple TV.

    Trying to play purchased TV series to my Apple TV, I am requested to authorise the computer.  This has already been done and I have tried the suggestions regarding authorisation.  I can play the programs on my computer, but not the Apple TV.
    Any ideas?

    in remote app click on the
    lower left corner on the text
    top of the context menu click devices
    choose the appletv rather then your shared lib in the list
    if you are trying to view a movie that is located on your ipad on your tv using the appletv then
    you should use airplay mirror not the remote app

  • How do I get my deleted emails to go to the deleted items in Outlook and not the archived folder?

    How do I get my deleted emails to go to the deleted items in Outlook and not the archived folder?

    Who is the email account provider?
    With an Apple iCloud account, there is a preference setting with the account settings on the iPhone to archive messages - save deleted messages in your Archive folder.
    I believe the same is available with a Gmail account.

  • I cannot log onto the App Store, the page appears when I call it from the dock or the Apple menu. I can call the log-in box from the menu bar, but on signing in the spinning icon just keeps spinning,(not the beachball). Any suggestions? Using 10.6.7 and u

    I cannot log onto the App Store, the page appears when I call it from the dock or the Apple menu and I can call the log-in box from the menu bar, but on signing in the spinning icon just keeps spinning,(not the beachball).  Using 10.6.7 and up-to-date on all software. Any suggestions?

    Could be a third party app preventing you from being able to login.
    Mac App Store: Sign in sheet does not appear, or does not accept typed text
    If it's not a third party issue, follow the instructions here.
    Quit the MAS if it's open.
    Open a Finder window. Select your Home folder in the Sidebar on the left then open the Library folder then the Caches folder.
    Move the com.apple.appstore and the com.apple.storeagent files from the Caches folder to the Trash
    From the same Library folder open the Preferences folder.
    Move these files Preferences folder to the Trash: com.apple.appstore.plist and com.apple.storeagent.plist
    Same Library folder open the Cookies folder. Move the com.apple.appstore.plist file from the Cookies folder to the Trash.
    Relaunch the MAS.

  • My Iphone 4s is not being recognized by itunes at all. There is no connection, the cable i am using is not the problem because itunes will recognize my Ipad2 and Ipod thru it. I have the most current itunes and phone software I need help!

    My Ihone 4s is not being recognized by Itunes.There seems to be  no connection, the cable i am using is not the problem because itunes will recognize my Ipad2 and Ipod thru it. I have the most current itunes and phone software I need help!

    Thank you allan this worked, the final thing was updating the driver softwar for the AMDS in device manager. Thanks again.

  • How do i get my contacts back? they are backed up by i cloud but when I "MERGE" only the new ones are there and not the old ones

    how do i get my contacts back? they are backed up by i cloud but when I "MERGE" only the new ones are there and not the old ones

    Hi sfuentes,
    You need to check iCloud to see if they are actually there. Go to iCloud.com and sign in and then look at your Contacts there to see if the old ones are still showing on iCloud.
    If they are not, then you can either re-enter them while you are on iCloud.com, or you can restore your device from the backup where you saved them:
    https://support.apple.com/kb/ph12521
    Cheers,
    GB

  • HT1766 please help...we updated ipod2 4.1 to IOS 5.1 at itunes...after it was finished only the contacts were restored...not the music & videos...we found the backed up data in the pc(windows 7)after entering %appdata%..pls help how to restore..thanks!God

    please help...we updated ipod2 4.1 to IOS 5.1 at itunes...after it was finished only the contacts were restored...not the music & videos...iwe found the backed up data in the pc(windows 7)after entering %appdata%..pls help on how to restore...we will appreciate it very much....thanks! God bless!

    The iPod backup that iTunes makes does not include synced media like app, music and videos. Thus, you wll have to resync those back to your iPod.
    If necessary you can redownload iTunes purchases by:
      Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • My iMac keeps typing a minus sign. I switched my wireless keyboard for a plug in Windows keyboard, and it keeps typing this one character. I took the batteries out of the Mac keyboard, so that is not the problem. I am running Mac OS X 10.6.8.

    my iMac keeps typing a minus sign. I switched my wireless keyboard for a plug in Windows keyboard, and it keeps typing this one character. I took the batteries out of the Mac keyboard, so that is not the problem. I am running Mac OS X 10.6.8. In parallels, I don't have any problem, just on the Mac platform.

    tebasj wrote:
    Thanks for your observation. I realize they are different versions, but when I use the "Software Update" menu, this is as far as it would update. Is there some way to update the iMac beyond what "Software Update" does? I've tried it several times.
    Please Note.
    Upgrading OSX 10.6.8 (Snow Leopard) to 10.8.3 (Mountain Lion) is not an update. It is a paid upgrade. Just as with 10.7 (Lion) you must purchase it from the App Store with yor Apple ID and install it after backing up your current computer state for safety.
    Cheers
    Pete

  • I am trying to open a pages document however it tells me I need the new version to do so. I have installed the new version however it keeps saying I need the new version. I have noticed that I still have the old blue ink pot icon not the new orange pen.

    I am trying to open a pages document however it tells me I need the new version to do so. I have installed the new version however it keeps saying I need the new version. I have noticed that I still have the old blue ink pot icon not the new orange pen.

    Are you launching Pages from an icon in your Dock? Installing the update does not change the Dock icons & it does not remove the older versions. Go to your Applications folder & launch the new Pages from there.

  • Why can't I save text I've entered into a PDF file?  When I hit "Save As", only the PDF document is saved, but not the text i typed into the document.  I'm using Windows 8.

    Why can't I save text I've entered into a PDF file?  When I hit "Save As", only the PDF document is saved, but not the text i typed into the document.  I'm using Windows 8.

    THANK YOU!
    Jan Whitfield
    The College Planning Center
    250 Palladio Parkway, Suite 1311
    Folsom, CA 95630
    (916) 985-0453
    www.TheCollegePlanningCenter.com

  • I have a new iPod and now I can't buy something on it ,because of the safety questions. I have not the answers. I can't remember that answer the questions.

    I have a new iPod and now I can't buy something on it ,because of the safety questions. I have not the answers. I can't remember that answer the questions.

    Frequently asked questions about Apple ID - http://support.apple.com/kb/HE37 --> Can I change the answers to the security questions for my Apple ID?  --> Yes. You can change the answers to the security questions provided when you originally signed up for your Apple ID. Go to My Apple ID (http://appleid.apple.com/) and click Manage your account.
    Forgotten security questions - https://discussions.apple.com/message/18402551  and https://discussions.apple.com/message/18625296
    More involved forgotten question issues - https://discussions.apple.com/thread/3961813
    Kappy 09/2012 post about security questions - https://discussions.apple.com/message/19569468
    John Galt's tips (09&11/2012) - https://discussions.apple.com/message/19809294 and https://discussions.apple.com/message/20229239
    If none of the above work, contact iTunes Support at http://www.apple.com/support/itunes/contact/ and follow the instructions to report the issue to the iTunes Store.

  • TS1702 I had this Scrabble on my iPad2 and began to have connection problems, it would lock in the "connecting" position. This is not the first time Scrabble has had problems with interface. Typically customers delete the Ap then download it again to rein

    I have contacted EA about this and can find no help. I had this Scrabble on my iPad2 and began to have connection problems, it would lock in the "connecting" position. This is not the first time Scrabble has had problems with interface. Typically customers delete the Ap then download it again to reinstall it. During the process you sign in and approve the purchase KNOWING that another window will open saying that you have previously purchased it and that there is no charge. So what happened this time? It will not connect and all of my saved and current games are wiped out. I want my money back, this game interface is pretty junk and operates like some ancient DOS program,,bug,bug,buggy. I want my money back.

    Go here:
    http://www.apple.com/support/itunes/contact/
    and follow the instructions to report the issue to the iTunes Store.
    Regards.

  • I'd copied some pictures from a PC to a folder in Finder in my new iMac. The 'Date Created' in iMac is not the same as the 'Date Created' in the PC. Why? Is there a way to fix that?

    I'd copied some pictures from a PC to a folder in Finder in my new iMac. The 'Date Created' in iMac is not the same as the 'Date Created' in the PC. Why? Is there a way to fix that?

    View Menu -> Sort Photos is a good way to start.
    Some organising possibilities in iPhoto:
    I use Events simply as big buckets of Photos: Spring 08, July - Nov 06 are typical Events in my Library. I use keywords and Smart Albums extensively. I title the pics broadly.
    I keyword on a
    Who
    What
    Where basis (The When is in the photos's Exif metadata). I also rate the pics on a 1 - 5 star basis.
    Using this system I can find pretty much find any pic in my 50k library in a couple of seconds.
    So, for example, I have a batch of pics titled 'Seattle 08' and a  typical keywording might include: John, Anne, Landscape, mountain, trees, snow. With a rating included it's so very easy to find the best pics we took at Mount Rainier.
    File -> New Smart Album
    set it to 'All"
    title contains Seattle
    keyword is mountain
    keyword is snow
    rating is 5 stars
    Or, want a chronological album of John from birth to today?
    New Smart Album
    Keyword is John
    Set the View options to Sort By Date Ascending
    Want only the best pics?
    add Rating is greater than 4 stars
    The best thing about this system is that it's dynamic. If I add 50 more pics of John  to the Library tomorrow, as I keyword and rate them they are added to the Smart Album.
    In the end, organisation is about finding the pics. The point is to make locating that pic or batch of pics findable fast. This system works for me.

  • The original u201CBP_CONFIRMu201D is running and not the redefine one.

    Hi,
    In Component CRMCMP_BPIDENT,
    I have enhanced the custom controller CRMCMP_BPIDENT/CuCoBuPa
    and redefined the method u201CBP_CONFIRMu201D with my logic.
    But when I run the IC web client the original u201CBP_CONFIRMu201D is running and not the redefine one.
    Why ?
    Thanks in advance.

    Amit,
    We have not yet transported our Enhancement Set through the landscape, but I suspect you will need to maintain the assignment (BSPWDV_EHSET_ASG) in each system for the reason you give. 
    Your created Enhancement Set (BSPWDV_EHSET_DEF) will still transport through, then you will need to go into table maintenance for BSPWDV_EHSET_ASG once the set has been transported into your QAS system, and then assign it to your QAS clients.
    Many thanks,
    Andrew Griffin.

Maybe you are looking for