Skip to main content
Ben Nadel at cf.Objective() 2013 (Bloomington, MN) with: Loveena Dsouza and Ritika Chowdhary
Ben Nadel at cf.Objective() 2013 (Bloomington, MN) with: Loveena Dsouza Ritika Chowdhary

ColdFusion Support In jQuery

Published in , Comments (10)

I am sure I have not been the first one to point this out, but someone just pointed it out to me (and I hadn't seen it before). The good people over at have created a jQuery plugin that mimics many of the built in ColdFusion functions. Come on CF'ers, no reason to not dive right into Javascript now :)

Here is a list of the available functions (as taken from their site):

  • Abs( number )
  • ArrayAppend( array, value )
  • ArrayLen( array )
  • ArraySort( array, sort_type [, sort_order ] )
  • ArrayToList( array [, delimiter ] )
  • Ceiling( number )
  • Compare( string1, string2 )
  • CompareNoCase( string1, string2 )
  • DateDiff( datepart, date1, date2 )
  • DecimalFormat( number )
  • DollarFormat( number )
  • Find( substring, string )
  • FindNoCase( substring, string )
  • Insert( substring, string, position )
  • IsDate( date )
  • IsNumeric( string )
  • LCase( string )
  • Left( string, count )
  • Len( sting )
  • ListAppend( list, value, [, delimiters] )
  • ListDeleteAt( list, position [, delimiters ] )
  • ListFind( list, value [, delimiters ] ) )
  • ListFindNoCase( list, value [, delimiters ] ) )
  • ListFirst( list, [, delimiters ] )
  • ListGetAt( list, position [, delimiters ] ) )
  • ListLast( list, [, delimiters ] )
  • ListLen( list [, delimiters] )
  • ListToArray( list [, delimiters] )
  • LTrim( string )
  • Mid( string, start, count )
  • Replace( string, substring1, substring2 [, scope ] )
  • ReplaceNoCase( string, substring1, substring2 [, scope] )
  • Reverse( string )
  • Right( string, count )
  • Round( number [, number of decimal places] )
  • RTrim( string )
  • StructKeyList ( struct [, delimiter] )
  • StructKeyArray ( struct )
  • Trim( string )
  • UCase( string )
  • URLDecode( string )
  • URLEncodedFormat( string )

Nicely done guys!

Reader Comments


Very cool.

A while ago, I did a little work towards porting all of CF's list functions to JavaScript in a way that was fully compatible with CF, while at the same time offering extended, optional functionality such as multi-character delimiters, regular expression delimiters, options for whether list items should be treated as case sensitive, whether empty list items should be preserved, etc., all within very tight code which didn't depend on a JS library. I've never gotten around to finishing it, but because I'd started this before the first thing I looked at in the code was their list functions. I must say that I'm a little disappointed that not only are many of the key list functions missing, but the others are not even close to compatible with ColdFusion. Oh well, there's always version 2 (or I could try to motivate myself to work on my JS list library).


First Ben, thanks for blogging about CFJS! :o)

Second, and I know it's been a while since the post, but CFJS does now include all of the List functions (except for ListQualify. I didn't feel like that would be a very handy function in JS).

Anyway, I invite you and your readers to check out the latest version of the code. Also, someday (hopefully soon, as it's not that hard), I'll be creating a branch of CFJS that is *not* a jQuery extension.


Chris, again, very nice work! However, since you specifically noted the list functions, I've noticed that they are still not compatible with CF. E.g., empty list items are not ignored, and delimiters are handled completely differently (though your delimiters are superior to CF's since multi-character and regex delimiters can be used).



Thanks for responding. I realize that empty list items are not ignored so my list functions are different in that way. I suppose I could allow the user to pass a switch that would turn this behavior off, but how many folks would want that? I always thought that ignoring empty list items was a mistake on CFs part. In fact a good friend of mine wrote a UDF called ListFix, that puts a null character of the user's choice in place of the empty list items.

Maybe I should note these differences in the ChangeLog or on my site somewhere (since there is no real documentation). What would you suggest? :o)




It might be worth mentioning that the function list has grown. The library contains about 67 functions including some date/time functions. I've got plans for about four or five more functions, that I'll be coding soon.




Yeah, IMO the most useful piece of documentation would be a list of how your functions differ from CF (even, or especially, when your versions are more useful), since I imagine most people who use your library would already be familiar with how the CF versions work (or at least they could look them up in the livedocs).

Whenever you think the library is at a good point (e.g., now), you should submit it to Ajaxian (from there it will easily spread further). Ajaxian is a great blog but they very rarely post anything CF-related. They would almost certainly link to your library.



Thanks heaps for the suggestions!

I had a user suggest that I host it with I took a chance and did just that. The library got more exposure than I imagined it ever would. I'll see about listing it on Ajaxian, too! :o)

Also, I think you're absolutely right about the needed documentation. I just posted a note to my local CFUG that a new non-jQuery version was now available, and the head honcho guy wanted me to post the differences between my library and LeftCorner.js ( since it was that library I started out with. I've since added more than thirty functions and made numerous bug fixes.

Maybe later today, I'll post those differences along with some needed documentation.

Feel free to make more suggestions or criticisms. I love getting feedback.


I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel