Solved

Using Sortable Serialize on mulitple ULs

Posted on 2008-11-02
2
551 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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

624 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