Using a CFC to drive content to cftooltip

An AJAX quickie for you this morning. A user asked if it was possible to use a CFC to drive content to cftooltip. He had noticed that unlike other AJAX UI items, the cftooltip doesn’t let you use a bind to point to a CFC/JavaScript/URL source. It only provides one argument - sourceForTooltip.

This does not mean, however, that you can’t use a CFC. Do no forget CFCs under web root can still be accessed via URL. Here is a very simple example:

<cftooltip sourceForTooltip="test.cfc?method=getsource&returnFormat=plain"> The content to be wrapped. The content to be wrapped.<br /> The content to be wrapped. The content to be wrapped. </cftooltip>

All I’ve done here is point to a CFC in my URL. The method argument just tells the server which CFC method to run. The returnFormat is important. If you leave this off, the result will be a WDDX string. Now this actually rendered ok in my browser, but you really want to use the returnFormat=plain to ensure a non-encoded response.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments