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

  • Home
  • SEARCH
  • 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 6006709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:34:43+00:00 2026-05-23T01:34:43+00:00

I have a new batch form where user can select books from a div

  • 0

I have a new batch form where user can select books from a div using the checkbox and click on a button to put them in another div which represents the selected books.

It works a bit like a listbox where user can move items between the different boxes except that here am using checkbox and div.

I have done the moving of books from one div to another using jquery.

See code below:

<% form_for @batch do |f| %>
<label style="width: 150px">Batch Name:</label><%= f.text_field :BAT_BATCH_NAME %>  



<div id="all_books">

<% @books.each do |book| %>
<div id="book<%= book.BK_OID %>" bookid="<%= book.BK_OID %>" class="innertxt">

<ul>
<li>Book ID: <%= book.BK_OID %></li>
<li>Name: <%= book.BK_NAME %></li>
<li>
<input type="checkbox" name="batch[book_ids][]" id="select<%= book.BK_OID %>"  value=<%= book.BK_OID %> class="selectit" />

</li>
</ul>

</div>
<% end %>


<div style="width:100px; text-align:center; margin-left:20px; padding-top: 100px; width:75px; float:left;">
<a href="javascript:void(0);" id="move_right">Right &raquo;</a><br /><br />
<a href="javascript:void(0);" id="move_left">&laquo; Left</a>
</div>


<div id="selected_books"> </div>
<br/><br/>

<%= f.submit 'Update Batch Details' %>


<% end %>

Currently, only the selected books are saved, whether they are found in the ‘all_books’ div or ‘selected_books’ div.

However, I want all entries in the ‘selected_books’ div to be submitted when saving the batch, whether their checkboxes have been checked or not. and ignore all selected entries in the ‘all_books’ div.

In short, when saving the batch, i want to save only those books found in the ‘selected_books’ div and ignore the rest whether their checkboxes have been checked or not.

I hope i was clear enough.

I would be really grateful if someone could point me the right direction on how to do that.

Many many thanks for any suggestion provided.

  • 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-05-23T01:34:44+00:00Added an answer on May 23, 2026 at 1:34 am
    $("#formid").submit(function(){ $("#selected_books").find("input:checkbox").attr({checked: "checked"}); });
    

    That should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a new project which simply put, is an attempt to formalize the
We have a new application that requires glibc 2.4 (from gcc 4.1). The machine
Hi all I am new to batch files and struggling.I am using sql server
I am experienced with Spring, but new to Spring Batch. Now I have the
I have a batch file that creates a scheduled task using schtasks like this:
i have a datatable: var dt = new DataTable(); dt.Columns.Add(new DataColumn(specimen, typeof(string))); dt.Columns.Add(new DataColumn(batch,
i have a batch of Smarty files that i need to extract strings from,
I have a new 1 TB drive coming in tomorrow. What is the best
I have a new object with a collection of new objects within it on
I have a new VPS server, and I'm trying to get it to connect

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.