multiSelect and the order of submitted elements

16 views
Skip to first unread message

Gustav van der Merwe

unread,
Nov 3, 2015, 11:54:11 AM11/3/15
to Lift
I'm using a plugin like https://github.com/vicb/bsmSelect to create a re-orderable multiselect.

However, I find when submitting to the server that the order of the elements is not retained.

I've seen online that the name of multiselects that carries an ordering should be suffixed with [] - see: http://stackoverflow.com/questions/3089849/ruby-on-rails-submitting-an-array-in-a-form

Is there any way to achieve this using the buitin helpers that lift has? I'm dreading writing my own... How will I get the data back into Lift as all of the builtin form helpers use the secure Lift hashes?

Not that I'm suggesting getting rid of the hashes, simply suffixing them with [] in the select.

Regards,
Gustav van der Merwe

signature.asc

Gustav van der Merwe

unread,
Nov 3, 2015, 12:13:25 PM11/3/15
to lif...@googlegroups.com
Apologies, it seems I did not get the issue exactly down. Instead of not getting to the server in the right order (which it does seem to do) it loses it's ordering when creating the multiselect, ordering by value and not as the list was passed into the multiSelect function. So the issue is in form /generation/.
signature.asc

Gustav van der Merwe

unread,
Nov 3, 2015, 12:23:22 PM11/3/15
to lif...@googlegroups.com
Actually you know what, sorry for the noise. Turns out the multiselect was being ordered by the full set of possibilities that were handed to it, rather than the ordering of those that were already selected.

All sorted now, just had to generate it right on the server.
signature.asc

Antonio Salazar Cardozo

unread,
Nov 3, 2015, 1:07:36 PM11/3/15
to Lift, gv...@gvdm.me
Sweet, thanks for reporting back and letting us know what the issue was :)
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages