• Home
  • About George
  • Contact Me
Blue Orange Green Pink Purple

Posts Tagged ‘script.aculo.us’

You can use the search form below to go through the content and find a specific post or page:

Apr 16

script.aculo.us Ajax Sortable Lists adjustment for ColdFusion

So normally I’m a YUI guy. I enjoy their widgets and some of the other features available, and I’m comfortable with it. I work with several sites here that my co-workers work on, and they often prefer different JS Libraries. So I try to minimize the libraries on a site. Nothing more difficult, I feel, when you’re maintaining a website and have to maintain YUI, jQuery, Dojo, and Script.aculo.us/Prototype all at the same time and with all of those libraries loading for a client!

So I had to repair something that wasn’t working in IE8 (imagine that :) ) that was written quite some time ago. The site had script.aculo.us/prototype on it so I wanted to stick with that library. Thankfully, I came across this post: http://zenofshen.com/posts/ajax-sortable-lists-tutorial and it’s a pretty handy layout for PHP and Script.aculo.us. The problem arises at the bottom of the post. In PHP, you would be fine using this:

1
parse_str($_POST['data']);

ColdFusion won’t parse out the string of list_to_sort[]=2&list_to_sort[]=1&list_to_sort[]=3 like that though. So I recommend making this adjustment to what’s coming through:

1
2
3
4
5
6
7
8
9
10
11
<cfset newList = ListChangeDelims(url.data, "|", "list_to_sort[]=,&list_to_sort[]=")>
<cfset sortPos = listLen(newList, "|")>
 
<cfloop list="#newList#" delimiters="|" index="thisID">
       <cfquery name="insertSort" datasource="#request.source#">
               INSERT INTO 'table' (listID, sortOrder)
                     VALUES (#thisID#, #sortPos#)
        </cfquery>
 
        <cfset sortPos = sortPos - 1 />
</cfloop>

Web Development By George

  • About
    About me. Edit this in the options panel.
  • Photo Stream
  • Categories
    • ColdFusion
    • coldspring
    • Databases
    • Design
    • Flash
    • Flex
    • Internet
    • JavaScript
    • jQuery
    • Model-Glue
    • Personal
    • Subversion
    • Uncategorized
    • YUI
  • Recent Articles
    • Radios and JQuery and IE8
    • Coldfusion, Flex, and SSL
    • Leaving it to the Experts
    • CFAjaxProxy Problems or RTFM
    • I love the Internet
    • Interesting ColdFusion Survey
  • Archives
    • November 2011
    • May 2011
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • November 2009
    • October 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
  • Search




Add to Technorati Favorites

  • Home
  • About George
  • Contact Me

© Copyright Web Development By George. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top