ColdFusion Support In jQuery
Posted March 15, 2007 at 10:49 AM by Ben Nadel
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!
- Wanted: Full-Time ColdFusion Developer at Intoria Internet Architects
- Cold Fusion Senior Developer at Edge Information Management
- Back-End Web Developer-Information Technologist at Michigan State University
- ColdFusion Developer at Nonfat Media
- Mid-to-Senior Level Web Application Developer at SiteVision, Inc.
Thanks for pointing this out Ben. It will help a lot.
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).
Good work. I know a bunch of people who love these list functions.
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 RIAForge.org. 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 (LeftCorner.com) 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.
It would be better if you put a quick download for the jquery plugin. I lost at site :o