Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using Sortable Serialize on mulitple ULs

Posted on 2008-11-02
2
Medium Priority
?
561 Views
Last Modified: 2012-05-05
I have a page with multiple ULs and I need to be able to re-order them.

My current code which is working sorting the page, but doesn't write to the database is as follows:

<script type="text/javascript">
function updateOrder(){
  var options = {
    method : 'post',
    parameters : Sortable.serialize('item_list<%=RScat.Fields.Item("subCatID").Value %>')
  };
new Ajax.Request('order-update.asp', options);
}
</script>
<ul id="item_list161">
        <li class="clearfix" id="item_2497" style="cursor:pointer;">name</li>
        <li class="clearfix" id="item_2498" style="cursor:pointer;">name2</li>
</ul>
<script type="text/javascript">
  Sortable.create('item_list161', {constraint:'vertical', onUpdate : updateOrder});
</script>

<script type="text/javascript">
function updateOrder(){
  var options = {
    method : 'post',
    parameters : Sortable.serialize('item_list<%=RScat.Fields.Item("subCatID").Value %>')
  };
new Ajax.Request('order-update.asp', options);
}
</script>
<ul id="item_list162">
        <li class="clearfix" id="item_2597" style="cursor:pointer;">name</li>
        <li class="clearfix" id="item_2598" style="cursor:pointer;">name2</li>
</ul>
<script type="text/javascript">
  Sortable.create('item_list162', {constraint:'vertical', onUpdate : updateOrder});
</script>

I have several of these on the page, what I don't know how to do is pass the <%=RScat.Fields.Item("subCatID").Value %> to the order-update.asp page so that each list can be uniquely updated.

The order-update.asp page is as follows:

<%
Dim myString, myArray
myString = Request("item_list[]") 'get the string/list by Request
myArray = Split(myString, ",") 'split the string at commas and put in array

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open MM_bath_STRING

'loop through the array of items
For i=0 to UBound(myArray)
objConn.Execute("UPDATE products SET [productOrder]="&(i+1)&" WHERE productID="&trim(myArray(i))) 'update record
Next

objConn.Close
Set objConn = Nothing
%>

Thanks

Chris
0
Comment
Question by:djfenom
2 Comments
 
LVL 7

Accepted Solution

by:
bluV11t earned 2000 total points
ID: 22862425
Couldn't you pass it in the querystring and then handle it in order-update.asp?

new Ajax.Request('order-update.asp?subCatID=<%=RScat.Fields.Item("subCatID").Value %>', options);

0
 

Author Comment

by:djfenom
ID: 22865407
Doh! Knew it would be something simple.

Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question