Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:52:52+00:00 2026-06-17T04:52:52+00:00

I have this page: there is an option of sortable: move items from the

  • 0

I have this page:

enter image description here

there is an option of sortable: move items from the lower table to the upper table. at this moment, I have only two items (each table has one item).

The upper table contains tasks for a worker that weren’t done and the lower table contains tasks for a worker that were done.

the word: Yes/No says if the task were/weren’t done.

I am trying to do the next thing:

when user move an item from the lower table to the upper table, I want the checkbox to be automatically checked (so it always move from ‘Yes’ to ‘No’).

this is my index.html.erb (I use best_in_place in order to update the database while the value is changed):

<html>
<body>

<ul id="sortable1" class="connectedSortable"> 

  <% @tasks_worker_todo.each do |task| %>
        <li class="ui-state-default">
            <%= best_in_place task, :done, :classes => 'highlight_on_success', type: :checkbox, collection: %w[No Yes] %> | 
            <%= task.admin_mail %> | 
            <%= task.task %>
        </li>
  <% end %>
</ul>

<br><br>

<ul id="sortable2" class="connectedSortable">
  <% @tasks_worker_done.each do |task| %>
        <li class="ui-state-highlight">
            <%= best_in_place task, :done,:classes => 'highlight_on_success', type: :checkbox, collection: %w[No Yes] %> | 
            <%= task.admin_mail %> | 
            <%= task.task %>
        </li>
  <% end %>
</ul>

and this is my application.js

$(document).ready(function(){
 jQuery('#sortable1, #sortable2')
 .sortable(
 {'connectWith':'#sortable1',
 'dropOnEmpty':true,
 'scroll':true,
  items: "li:not(.emptyMessage)",
  receive: function(event, ui) {
         alert('moved');
         //hide empty message on receiver
         $('li.emptyMessage', this).hide();

         //show empty message on sender if applicable
         if($('li:not(.emptyMessage)', ui.sender).length == 0){
             $('li.emptyMessage', ui.sender).show();
             alert('alon');
         } else {
             $('li.emptyMessage', ui.sender).hide();
         }            
     }

  });
});

any help appreciated!

Update:

this is the HTML that ruby generates:

<!DOCTYPE html>
<html>

<head> 
<title>TODOLIST</title> 


<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/admin.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/scaffolds.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/tasksadmins.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/workers.css?body=1" media="all" rel="stylesheet" type="text/css" /> 
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-ui.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.purr.js?body=1" type="text/javascript"></script>
<script src="/assets/best_in_place.js?body=1" type="text/javascript"></script>
<script src="/assets/admin.js?body=1" type="text/javascript"></script>
<script src="/assets/myjquery.js?body=1" type="text/javascript"></script>
<script src="/assets/tasksadmins.js?body=1" type="text/javascript"></script>
<script src="/assets/workers.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script> 
<meta content="authenticity_token" name="csrf-param" />
<meta content="FZho6dNmNWjn82HB+MzhL/MtIm4s6F7JFiLVysPCREY=" name="csrf-token" /> 
</head>

<body>
<div id="right">

    <li><a href="/users/sign_out" data-method="delete" rel="nofollow">Sign out</a></li>

</div>
<p id="notice"></p>
<p id="alert"></p>
<center>
<html>
<body>


 <ul id="sortable1" class="connectedSortable"> 


    <li class="ui-state-default">
        <span class='best_in_place highlight_on_success' id='best_in_place_tasksadmin_1_done' data-url='/tasksadmins/1' data-object='tasksadmin' data-collection='["No","Yes"]' data-attribute='done' data-type='checkbox'>No</span> | 
        admin216@gmail.com | 
        feed the dog
    </li>
</ul>


<br><br>

<ul id="sortable2" class="connectedSortable">
    <li class="ui-state-highlight">
        <span class='best_in_place highlight_on_success' id='best_in_place_tasksadmin_2_done' data-url='/tasksadmins/2' data-object='tasksadmin' data-collection='["No","Yes"]' data-attribute='done' data-type='checkbox'>Yes</span> | 
        admin216@gmail.com | 
        feed the fish
    </li>
</ul>


</body>
</html>
</center>

</body>
</html>

p.s. I know that I have two body and two html. I will order it tomorrow.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:52:53+00:00Added an answer on June 17, 2026 at 4:52 am

    Try this in the receive handler:

    The element being moved is ui.item

     ui.item.find('span').click();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this MySQL statement from a search page, the user enters there postcode
On this page there is a list of footer links that have a little
I have this situation: There are a login page with a login form (form
I have this file 'gardens.php' , which pulls data from a table called 'generalinfo'
I have this page which has three peson searchs on them. Basically it's a
So I currently have three unordered lists in my header. This is a single-page
I have this page: http://www.thedome.it/cmsms/index.php?page=alla-spina I'd like to send a newsletter to subscribers every
i have this page . login: fer password: m Note: after login you will
I have this serious: I have ASP.NET page, This page contents Update panel with
So I have this page here: http://www.eminentmedia.com/development/powercity/ As you can see when you mouse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.