Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Sortables -> input field WordPress

  • SOLVED

My brain must be fried as I can't figure out how to get the order of my sortable list into an input field for use in a WordPress plugin:

http://demo.pixopoint.com/static/sortables/

Prize winner will be the first one to provide a demo which loads the order of the boxes into the input field.

Answers (4)

2011-05-04

Christianto answers:

Include the form on ui-sortable wrap


<div id="faq" class="ui-sortable">

<div id="q2">Two</div>
<div id="q100" style="" class="">Three</div>
<div id="q1" style="" class="">One</div>
<form action="" id="faq_form">
<input type="text" name="faqs" id="faqs">
</form>
</div>



Christianto comments:

OMG I misunderstood your question...
sorry.. :D


Christianto comments:

Please try

jQuery(document).ready(function($){
// Sortable form
$("#faq").sortable({
update: function(){

var pos = [];
$('#faq > div').each(function(i){
pos[i] = $(this).attr('id');
});

$('#faqs').val(pos[i].toString());

}
});

});


Christianto comments:

Some fix and demo

jQuery(document).ready(function($){
// Sortable form
$("#faq").sortable({
update: function(){

var pos = [];
$('#faq > div').each(function(i){
pos[i] = $(this).attr('id');
});

$('#faqs').val(pos.toString());

}
});

});


Christianto comments:

Oh.. html is not allowed.. :(
change the extension txt to html on file attach..