Solved

Using Sortable Serialize on mulitple ULs

Posted on 2008-11-02
2
543 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP: Filling Out/Creating a PDF 29 94
Sending ASP to server side 8 28
Can't get js code to execute 8 30
what should i learn? javascript or typescript? 3 32
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
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…

685 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