Forum: Ruby on Rails Submitting sortable_element as part of form

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Justin Streufert (Guest)
on 2006-04-05 05:12
(Received via mailing list)
Good evening all...

I've been marveling over how easy it is to make amazing drag-sort
interfaces using sortable_element. My users are really blown away by
how intuitive and simple these controls are. However, in my current
project I'm trying to use it in a particular way which has me stumped.

Normally the sortable_element makes an AJAX request whenever it is
changed. But in this case, my sortable is part of a larger form which
contains other fields that must be filled in. I want to submit the
entire form, only when the user is finished, using a normal Submit
button at the bottom of the form.

Obviously, since the sortable_element is not actually a form field,
it does not get sent along with the POST request when the user hits
the submit button. My question: Can anyone tell me the correct way to
include a representation of the sortable's contents along with the
form submission? Do I need to make some kind of observer that
serializes the sortable_element into a hidden form field (and if so,
how ;)) or is there a more elegant way?

I would appreciate it very much if someone could point me towards a
code sample or any other information on this subject.

Thanks much!!
This topic is locked and can not be replied to.