Hi everyone, using scriptaculous I'm trying to allow the order of a
set of checkboxes to be modified before the contents of the form is
submitted. The sortable works great, you can drag and drop checkboxes
to your hearts content, but when you submit the form (not using ajax),
the order of the elements is as it was when the page was originally
loaded. Is there a way to get the browser to submit the elements in
the new order?
Here's some sample code:
<form action="/admin/construction/construction_zone/nuggets/2"
class="databaseinput" method="post">
<fieldset>
<p>
<label>Mookie Nuggets</label>
<span class="chunk" id="Mookie">
<div class="nowrap draggable" id="Mookie_7">
<input checked="checked" class="view" id="Mookie_7"
name="Mookie[7]" type="checkbox" value="Mookie" />
<span class="handle">Want some more?</span></div>
<div class="nowrap draggable" id="Mookie_5">
<input checked="checked" class="view" id="Mookie_5"
name="Mookie[5]" type="checkbox" value="Mookie" />
<span class="handle">My Testimonials</span></div>
<div class="nowrap draggable" id="Mookie_6">
<input class="view" id="Mookie_6" name="Mookie[6]" type="checkbox"
value="Mookie" />
<span class="handle">Fakie Wakie</span></div>
</span>
</p>
<p>
<label>Wookie Nuggets</label>
<span class="chunk" id="Wookie">
<div class="nowrap draggable" id="Wookie_6">
<input checked="checked" class="view" id="Wookie_6"
name="Wookie[6]" type="checkbox" value="Wookie" />
<span class="handle">Fakie Wakie</span></div>
<div class="nowrap draggable" id="Wookie_5">
<input checked="checked" class="view" id="Wookie_5"
name="Wookie[5]" type="checkbox" value="Wookie" />
<span class="handle">My Testimonials</span></div>
<div class="nowrap draggable" id="Wookie_7">
<input class="view" id="Wookie_7" name="Wookie[7]" type="checkbox"
value="Wookie" />
<span class="handle">Want some more?</span></div>
</span>
</p>
<p class="buttons">
<input name="commit" type="submit" value="Save" />
<a href="/admin/construction/construction_zone/list">Cancel</a> </
p>
</fieldset>
</form>
<script type="text/javascript">
//<![CDATA[
Sortable.create("Mookie", {handle:'handle', onUpdate:function(){new
Ajax.Request('#', {asynchronous:true, evalScripts:true,
parameters:Sortable.serialize("Mookie")})}, only:'draggable',
tag:'div'})
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
Sortable.create("Wookie", {handle:'handle', onUpdate:function(){new
Ajax.Request('#', {asynchronous:true, evalScripts:true,
parameters:Sortable.serialize("Wookie")})}, only:'draggable',
tag:'div'})
//]]>
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---