Entries Tagged as 'coldfusion'

Private instance vars show when JSON serialized in CF9

coldfusion , JavaScript

This is something I found interesting tonight. I made a CFC that sets private (variables scope) variables from the init parameters. They were not available by accessing them as obj.property, as expected. But when run through the serializeJSON function, those became available. I didn't expect this, but I think it's going to be handy for using them as lightweight transfer objects.

Why do people forget about JSStringFormat?

coldfusion , JavaScript 19 Comments »

I thought it was worth a quick post before I call it a night. Lately as I converse with colleagues who are getting more and more into the whole "Web 2.0" thing and therefore using more AJAX and JSON, I notice I'm sometimes the only one in the circle who recalls the awesome ColdFusion function JSStringFormat.

With this function you can take any amount of content and make it JavaScript friendly - you know, escaping single quotes and all that jazz. Even better is when you couple it with the cfsavecontent tag. Check this out, it's how I make a no-flash display.

<cfsavecontent variable="foo">This is some markup, can contain tons and tons of tags, even other script, etc.</cfsavecontent>
<cfoutput>
<script language="text/javascript">
var foo = '#JSStringFormat(foo)#';
</script>
</cfoutput>

ColdExt, the ExtJS Gateway Drug

coldfusion , extjs , JavaScript , Framework , AJAX , cftags 14 Comments »

Quick post tonight, as I'm between tasks. I've been wanting for a long time to get more familiar with ExtJS, a most excellent JavaScript application framework (can I call it that?). It's the good stuff that's built into ColdFusion 8, but that was version 1.1. Since then they've gone all the way to 3.0, and the platform is getting better and even more expansive.

What I wanted to do was get into it, but I kept getting sidetracked. It can be a bit to digest in one sitting - or even 10. Eventually, I heard of ColdExt, which is a ColdFusion, er, helper application... well, it's like training wheels. I hope that doesn't offend anyone - particular the ColdExt gang. It's really amazing what they've done. Using their imported tags you can get off the ground really fast using the familiar tag-ness that is ColdFusion but when it's processed and sent to the browser it's all proper ExtJS JavaScript.

Now, I LOVE this. What it's doing is providing me, the developer, those all-important positive and productive feedbacks we call "success". In no time I had an AJAX-powered grid with a CRUD form hooked up to the rows. Even better is that some of the things I wasn't completely familiar with in the ExtJS syntax was getting written for me. A quick view-source and I was staring at a guide for how the under-hood-goods were written. This has helped me gain mountains of comfortability with this JavaScript framework!

So, even if you don't want to use ExtJS through a layer of ColdFusion tags in the end, I highly recommend you ease into the deep and incredibly powerful world of ExtJS via ColdExt. It put the "RAD" back into my AJAX/Rich Client applications. That's just awesome.

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds