ColdFusion 11: cfclient ... how does normal CFML code and cfclient code interact?

G'day:
I am reposting this from my blog ("ColdFusion 11: ... how does normal CFML code and  code interact?") 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.
G'day:
Another quick one. I'm raising these quick-fire questions here because Adobe have declined to suggest a better place to raise them, other than as comments on one of their blog entries. Well that was Ram's suggestion (which I don't think is terribly-well thought out). He declined to react to my suggestion that the Adobe ColdFusion forums might be a good place. Anit suggested Twitter or just emailing him, but I think there'd be public interest in this stuff, so don't want to resort to email.
As I'm the master of what goes on on this blog: I'll clutter this thing up.
Say I want to have a mix of "normal" CFML and <cfclient>-based CFML in the same file. I can only presume the intent is to allow this, otherwise having <cfclient> as a tag rather than just a file extension seems like a poor approach. Obviously if one can have a start tag and an end tag, then code can come before (and I guess after) the <cfclient> tags themselves.
So I'd expect this to work:
<cfset message = "G'day World"> <cfclient> <cfoutput>#message#</cfoutput> </cfclient>
However all I get is an error in JS:
Uncaught ReferenceError: message is not defined variablesScopeVariable.cfm:4
And, indeed, the only mention of message in the JS source is the one that's erroring (as it's on the right-hand side of an assignment).
So I thought perhaps <cfclient> worked like <cfthread> and I needed to pass attributes into it:
<cfset message = "G'day World"> <cfclient message="#message#"> <cfoutput>#message#</cfoutput> </cfclient>
This doesn't compile:
Attribute validation error for the client tag.
The tag does not have an attribute called message. The valid attribute(s) are ''.
ColdFusion cannot determine the line of the template that caused this error.This is often caused by an error in the exception handling subsystem.
Note also there's an error in the error message itself. It's not the <client> tag, it's the <cfclient> tag.
Rightio then, so I tried just using the request scope instead (the code's the same as the variables-scoped example, except using the request scope). No dice: same JS error.
As a last ditch effort, I just tried to see if <cfclient> was aware of anything going on around it, by passing a value on the URL, and seeing if <cfclient> saw that, eg:
<cfclient> <cfoutput>#URL.message#</cfoutput> </cfclient>
This behaved differently from the variables- / request- scoped examples, in that I didn't get a JS error, I just got this on the screen:
undefined
And no JS error. It pains me to have to do this, but let's look at the generated JS to see why the behaviour is different:
Variables scope example:
<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 _$variablesScopeVariable_func=function(){     var self=this;     var variables={};     self.__init=function(){         var localdivstruct=globalDivStruct;         var __output_var="";         var tmpVarArray={};         localdivstruct.outputvar+=message;        return""     } }; function __startPage__$variablesScopeVariable(){     document.write("\x3cdiv id\x3d'__cfclient_0'\x3e\x3c/div\x3e");     window.ispgbuild=false;     var clientDivStruct={         divId        : "__cfclient_0",         outputvar    :""     };     globalDivStruct=clientDivStruct;     try{         _$variablesScopeVariable=new _$variablesScopeVariable_func;         _$variablesScopeVariable.__init()     }     catch(__eArg){         if(__eArg!=="$$$cfclient_abort$$$")             throw __eArg;     }     __$cf.__flush(clientDivStruct) } __startPage__$variablesScopeVariable(); </script>
The only significant difference (other than function names, based on the file names) between this and the URL-scoped example is the indicated line above is replaced by this in the URL example:
localdivstruct.outputvar+=__$cf.__arrayGet(URL,"message",true);
So it's like it's trying to do the right thing, but just failing. I thought it might be because CF does stupid thinks with scope-key casing, and changed the <cfclient> code to expect URL.MESSAGE not URL.message, but this didn't work either.
So I'm flummoxed. I can't find anything in any documentation which might point me in the right direction, so anyone know what the story is here?
Update:At Joel's suggestion I tried this:
<script> message = "G'day World"; </script> <cfclient> <cfoutput>#message#</cfoutput> </cfclient>
Thisworked. Which elicits from me a mixture of "heh: cute" and "this is an abomination". 
Adam

PaulNibin wrote:
Hi Adam,
When you write code inside <cfclient>, it is translated to java script. It cannot access server side variables(defined outside cfclient).
<script> message = "G'day World"; </script> <cfclient> <cfoutput>#message#</cfoutput> </cfclient>
The above code works because, message is defined in a script block and client side CFML is interoprable with javascript. So client side CFML can use variables, functions defined in javascript blocks.
Thanks,
Paul
So you're saying you did not provide a mechanism for transferring the variables from the server-side part of a file's code to the client side part? Is this not a bit of an oversight?
And what - in your mind - is the point of having a file with blocks of both normal CFML, and then a <cfclient> block, then more CFML, then another <cfclient> block (for example) if the code cannot interact?
Adam

Similar Messages

  • How do you connect your photoshop elements on your computer to your account online? and how do you create a customized url? how does the gallery work and how do you access it? i have trouble signing in on my program from my computer to connect to the onli

    how do you connect your photoshop elements on your computer to your account online? and how do you create a customized url? how does the gallery work and how do you access it? i have trouble signing in on my program from my computer to connect to the online photoshop, and I really want to create my own customized url and post photos to my gallery and share them with the world, family, and friends, but i need help because i can't figure how to do any of this, would really appreciate feedback and assistance, thanks, - claire conlon

    To add to sig's reply, "calibrating" does not calibrate Lithiu-Ion batteries, it calibrates the charge reporting circuitry.  If you look at the effect of deep discharging Lithium-Ion batteries in the data from the independent test group, Battery University, you will see that doing so shortens the life of the battery significantly. It looks like an optimum balance between use and life is at a discharge level of 50%.

  • How many new tax type and tax code  are created for change in TDS

    Hello Gurus.
    we are using SAP since more than  one year.
    now tDS rate is change , so i would like to know How many new tax type  and Tax Code is created in our system
    and also like to know At what percentage  i will crete that  new tax code.
    we have pair of tax type and tax code as shown in Example( for Interest) below
    Tax type        Tax code           Name
    I1      IC      Sec 194A - Interest on deposits
    I1      IO      Sec 194A - Interest on deposits OT
    I2      IC      Sec 194A - Interest on deposits Surcharg
    I3      IC      Sec 194A - Interest on deposits EC& SHEe
    I3      IO      Sec 194A - Interest on deps EC& SHEe OT
    I4      IC      Sec 194A - Interest on deposits Pymt
    I4      IO      Sec 194A - Interest on deposits Pymt OT
    I5      IC      Sec 194A - Interest on dep Pymt Surcharg
    I6      IC      Sec 194A - Interest on dep Pymt EC& SHEe
    so  how namy  additional  reuire to create new tax type and code more.
    i am waiting your reply.
    Regard,
    Riten patel
    Edited by: riten patel on Oct 29, 2009 10:23 AM
    Edited by: riten patel on Oct 29, 2009 10:23 AM
    Edited by: riten patel on Oct 29, 2009 10:33 AM

    Hello Hansachechani
    we have  followinng   tax key
    115O     Dividend 115O(1)
    192B     Salary
    194A     Interest income other than securities
    194C     Payment to contractors
    194H     Commission
    194I     Rent
    194J     Prof/Technical services
    195     Payment to foreign nationals
    206C     Tax Collected at Sources (Scrap)
    ST     Service Tax
    and we have followig tax type
    C4     Sec 194H Commission Payment
    C5     Sec 194H Commission Pymt Surcharge
    C6     Sec 194H Commission Pymt EC & SHE Cess
    D4     Sec 115O(1) Dividend Payment
    D5     Sec 115O(1) Dividend Pymt Surcharge
    D6     Sec 115O(1) Dividend Pymt EC & SHE Cess
    F4     Sec 195 Foreign Prof fees Payment
    F5     Sec 195 Foreign Prof fees Pymt Surcharge
    F6     Sec 195 Foreign Prof Fees Pymt E&HS Cess
    G1     Service Tax on GTA
    G2     Service Tax on GTA E Cess
    G3     Service Tax on GTA S&HE Cess
    I4     Sec 194A Int on Deposit Payment
    I5     Sec 194A Int on Deposit Pymt Surcharge
    I6     Sec 194A Int on Deposit Pymt EC & SHE Ce
    L4     Sec 194C Contractors Payment
    L5     Sec 194C Contractors Payment Surcharge
    L6     Sec 194C Contractors Payment EC&S HE Ces
    P4     Sec 194J Professional Payment
    P5     Sec 194J Professional Pymt Surcharge
    P6     Sec 194J Professional Pymt EC & SH E Ces
    R4     Sec 194I Rent Payment
    R5     Sec 194I Rent Payment Surcharge
    R6     Sec 194I Rent Payment E Cess & SH E Cess
    So Is it necessary to create new tax key and tax type?
    wheather i create new tax code only?
    I ma waiting your reply.
    Regard,
    Riten patel

  • How to enter Business place and section code of already posted documents

    Hello All,
    We have some posted documents from month of July, in which user has not entered business place and section code
    Please tell me how to enter business place and section code in these posted documents..
    I have already searched on other links, but were not useful..
    Thanks...

    Hi
    Can you share the screen shot and message no for the error? Also check if you have specified the actual MIRO Document No and not the FI Document No of MIRO Document.
    regards
    Sanil Bhandari

  • How to required Business Place and Section Code in FB60 screen

    Dear Guru
    Please guide me  how to required Business Place and Section Code in FB60 screen. in SAP
    Regards
    Tapan Maity

    Hi Tapan,
    Theer are various discussion over this issue . You can apply validation specific to transaction code as well as on the document type.
    Hope this would help you.
    Regards
    Pankaj P

  • How does CEF perform equal and unequal cost load balancing?

    hello
    How does CEF perform equal and unequal cost load balancing?
    thanks

    Hello Wang,
    it is only EIGRP that can perform load balancing over unequal cost links.
    For equal cost links CEF allocates 16 buckets and maps them to the the physical links.
    the result of a binary operation is used to associated a packet to an outgoing interface:
    Source IP address EXOR DEstination IP Address EXOR hash
    the hash is a seed that changes only at every reload.
    Actually the last 4 bits are used so that each flow can be classified in one bucket.
    then the outgoing interface is the one asscociated to the result of the exor operation.
    Another way to see is that m bits are used so that 2^m is equal to N number of links (if N is even)
    the rule is simple and pre-established
    Hope to help
    Giuseppe

  • Kindly advise how to enable payment terms and tax codes in f-22

    1. how  enable Payments terms field and Tax Code in f-22 because i have already configured payment terms in img.
    2. i have configured Sales and Purchase Tax and while posting in f-22 and in f-43, i seleted the Calculate tax but in third screen am unable to see the Tax code field to select my individual tax codes liek v0 for 0% input tax or v1-for calculation of Excise payable, cess payable and vst payable or v2.
    kindly advise how to enable
    1. Payment terms field
    2. Tax codes field
    in f-22

    Hello,
    first you should configure the tax codes and tax types. and payment mothod related to your company code.
    you can set the configure on tax code using the T>Code  :  FTXP in calculation bases.
    once you done the configuration of input/output tax  you can give the tax indicator on related *GL  master data*  in sales a/c and purchase  select the  input tax or out put tax.
    If your posting the document in F-22 or F-43  the system is not display the payment method you can go to field statues variant and select the required button in payment method  and save. t.code is OBC4 .
    you start the entry of document in   third screen click on  tax calculation button and  select  any one of this  Vo,V1 or V2. after you can simulate the entry the system generate the entry of below:
    vendor a/c  dr
      to vat 12.5% ; a/c  cr
      to service tax a/c  cr
      to ed.cess a/c cr
      to hr ed.cess cr
    if you have any doudts reply me.
    regards,
    Keerthi

  • HT1338 How does one uninstall Garageband and other things?

    How does one uninstall Garageband and other things on the Macbook air?

    Uninstalling Software: The Basics
    Most OS X applications are completely self-contained "packages" that can be uninstalled by simply dragging the application to the Trash.  Applications may create preference files that are stored in the /Home/Library/Preferences/ folder.  Although they do nothing once you delete the associated application, they do take up some disk space.  If you want you can look for them in the above location and delete them, too.
    Some applications may install an uninstaller program that can be used to remove the application.  In some cases the uninstaller may be part of the application's installer, and is invoked by clicking on a Customize button that will appear during the install process.
    Some applications may install components in the /Home/Library/Applications Support/ folder.  You can also check there to see if the application has created a folder.  You can also delete the folder that's in the Applications Support folder.  Again, they don't do anything but take up disk space once the application is trashed.
    Some applications may install a startupitem or a Log In item.  Startupitems are usually installed in the /Library/StartupItems/ folder and less often in the /Home/Library/StartupItems/ folder.  Log In Items are set in the Accounts preferences.  Open System Preferences, click on the Accounts icon, then click on the LogIn Items tab.  Locate the item in the list for the application you want to remove and click on the "-" button to delete it from the list.
    Some software use startup daemons or agents that are a new feature of the OS.  Look for them in /Library/LaunchAgents/ and /Library/LaunchDaemons/ or in /Home/Library/LaunchAgents/.
    If an application installs any other files the best way to track them down is to do a Finder search using the application name or the developer name as the search term.  Unfortunately Spotlight will not look in certain folders by default.  You can modify Spotlight's behavior or use a third-party search utility, EasyFind, instead.
    Some applications install a receipt in the /Library/Receipts/ folder.  Usually with the same name as the program or the developer.  The item generally has a ".pkg" extension.  Be sure you also delete this item as some programs use it to determine if it's already installed.
    There are many utilities that can uninstall applications.  Here is a selection:
        1. AppZapper
        2. AppDelete
        3. Automaton
        4. Hazel
        5. AppCleaner
        6. CleanApp
        7. iTrash
        8. Amnesia
        9. Uninstaller
      10. Spring Cleaning
    For more information visit The XLab FAQs and read the FAQ on removing software.

  • How to find the Connection and Security Code for iPad?

    I have a Canon ImageRunner 3025 at the office. I want to connect it with my iPad. I've downloaded the Canon Print & Scan App, but the app requires a Connection code and Security code.  Where can I find this on the printer? 

    Hi, thanks for posting! Canon does not provide direct support for imageRUNNER series products, but your dealer will be able to help you! If you don't have a dealer, please call us at 1-800-OKCANON (652-2666) and we will be happy to provide dealers who are in your area.

  • My husband was trying to reload and delete printers and he some how reset many settings on his mac book pro - how does he go back and set everything for earlier today

    My husband was trying to reload and delete printers and he some how reset many settings on his mac book pro - how does he go back and set everything for earlier today

    As Terence said you're experiencing a kernel panic. Boot into your System install disk and launch Disk Utility from the Utilities menu in the first window after the language selection window. Repair the disk. If DU finds problems and runs repairs do it a second time and then reboot.

  • How to Create New Hierarchy and Group Codes

    Hi,
    I have a requirement for create New Hierarchy Code and Group Codes...
    Please let me know the procedure of it..
    Thanks...

    solved

  • Case created without business partner, reason code and  result code

    In our CRM system, some cases was created without business partner, reason code and result code.
    We created some customer functions to make these fields as mandatory, it always work for our technique people and process expert, but it didn't work for some users occasionally. We cannot debug it.  
    Can anyone tell me why and how to solve it?
    Please help me !
    Regards,
    Shirley

    Hello Shirley,
    Well, then I would check the code, which calls your custom function modules.
    It may be possible, that you have an IF in the 'Main' program, which makes it possible to skip the custom FM for these users.
    The reason I am assuming this, is that normally you need just to change attributes for a field to make it mandatory, or customizing like SHD0 makes this possible. If you use custom FM, you have to call them somewhere and this is the point I would be looking for.
    Check the traces for the users and you should find, that the custom FM are not called for them.
    My opinion, of course
    Award points if this helps.
    Regards,
    Martin Kuma

  • Bapi_Acc_Document_Post - E 018 : Invalid tax code and company code combination

    Hi All,
    I need the help of this forum once again.
    I am using bapi Bapi_Acc_Document_Post to create KR documents in SAP. The bapi works absolutely fine except for one scenario:
    For a particular type of invoice coded to Company "XXXX" with lines having tax code "I0", the bapi returns error message "E 018 : Invalid tax code and company code combination". The tax code "I0" and the company code "XXXX" has been mapped in SAP and if I try to create the invoice manually in SAP using the GUI, the invoice gets created without any issue.
    I have tried searching the forum but could not find any post on this topic.
    Therefore, requesting the masters to please help me out on this.
    Best Regards
    Sutirtha Roy

    Hi Gowthami,
    how have you solved your problem, because I am facing the similiar issue and trying desperately to post the following combination with BAPI_ACC_POST_DOCUMENT:
    001 40       490100     Aufw. aus Marge PP              R2                 15,92
    002 31       10000003   Kreditor                                R2                 15,92-
    003 50       175060     Abzugsverfahren USt            R2                  3,18-
    004 40       154060     Abzugsverfahren Vst             R2                  3,18
    THANX!
    Regards
    Marko

  • Importing a journal voucher with GL Codes and BP Codes

    Hi Experts,
    I'm trying to get a DTW import for Journal Vouchers working on 8.8 PL05. I have a journal voucher template with GL Codes and BP Codes that I need to import as this is part of some integration.
    If I leave out the BP Codes it works fine but if I add them into the sheet is gives a DTW error "invalid account code application-defined or object-defined error 65171".
    I have tried to add BP code to shortname and add contra account.
    Please any help would be appreciated.
    Regards
    Lou van Wyk

    Welcome to SAP forum Lou...
    I do not know about 8.8 Journal vouchers, but some time ago we were importing with BP codes and we ran into a somewhat similar situation.  I believe we had to format the BP codes to Text in Excel before saving the file to CSV.
    Another time I was working with an individual who had not set up two BP Master Data records before doing transactions like it states in SAP's User Guide titled Data Migration and Opening Balances...
    Maybe that helps?
    Regards,
    Zal

  • Company code and other codes

    Hi Gurus
    Can I dislose the company code and other codes like Business area, sales organisation etc of my previous project to the interviewer?
    Thanks gurus

    hi,
    infact its better you tell how those things have been configured so that they understand how much you know and how the naming conventions were followed.
    Everything can be talked as long as its in the premise of professionalism and work.
    Thanks
    Sadhu Kishore

Maybe you are looking for

  • How can i connect my macbook air to a HD TV ?

    I want to connect my mac to my TV but there's no cable to connect from a thunderbolt port to a HDMI.    please help

  • Error while running bqy report

    Hi, When we are running BQY report from Interactive Web client. We are getting following error. Server Error [2009] : Exception in validateDBUser : Com.brio.one.services.das.proxy.DasCommException. Please help me.

  • Error In JCO Destination Creation

    Hi, I'm creating JCO Destination in Web Dynpro for Java. While finishing the JCO Destination wizard it shows a error as follows: Root Cause The initial exception that caused the request to fail, was: java.lang.IndexOutOfBoundsException: Index: 0, Siz

  • Itunes fails to install and repair cannot fix

    I have tried to download new version of itunes and it will not work and repair fails to remedy this

  • Flow of SD, MM, FI

    Hi Friends, Where can i get the very simple document.. which i give Flow of SD, MM, FI modules with diagrams.. Thanks Seshu