1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
<script type="text/javascript">
$().ready(function() {
$('#add').click(function() {
return !$('#select_from option:selected').remove().appendTo('#select_to');
});
$('#remove').click(function() {
return !$('#select_to option:selected').remove().appendTo('#select_from');
});
$('form').submit(function() {
$('#select_to option').each(function() {
$(this).attr("selected", "selected");
});
});
});
</script>
<div class="multi_select">
<%= select_tag("select_from",
options_for_select(@externs, @project.external_participants.collect { |c| c.id}),
{:multiple=>true, :size=>6})%>
<a href="#" id="add">Add >></a>
</div>
<div class ="multi_select">
<%= select_tag("select_to", options_for_select(@project_externs.nil? ? [] : @project_externs, @project.external_participants.collect { |ext| ext.id}), {:multiple=>true, :size=>6})%>
<a href="#" id="remove"><< Remove</a>
</div> |
Partager