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 6581193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:07:18+00:00 2026-05-25T16:07:18+00:00

In this JSFiddle http://jsfiddle.net/JQ6qF/ have I striped down the problem. Try click on Save

  • 0

In this JSFiddle

http://jsfiddle.net/JQ6qF/

have I striped down the problem.

Try click on “Save” and you will see that you get an alert.

Now click on either “Signed” or “A”. The rows are now sorted using TableSorter.

When clicking on “Save” now, then nothing happens, where I would have expected to see the alert box again.

Question

Can someone figure out to fix the JavaScript, so the Save button works even after the rows have been sorted?

HTML

<div class="page-body">

    <table class="alerts tablesorter" id="accTable" cellspacing="0">
        <thead> 
            <tr class="header">
                <th class="activity-header"> A </th>
                <th class="activity-header"> Signed </th>
                <th class="activity-header">  </th>
            </tr>
        </thead> 

        <tbody>      

            <form action="" method="post">
                <input name="anchor" value="7249" type="hidden">
                <tr class="row" id="7249">
                    <td class="activity-data">7249</td>
                    <!-- tablesorter can't sort a column with check boxes out-of-the-box, so it needs something to sort on. That is why the span tag is here -->
                    <!-- a jquery script is watching the state of the checkbox, so when clicked the value in the span is updated -->
                    <td class="checkbox"> <span style="display:none;">0</span> <input name="signed" type="checkbox" > </td>
                    <td class="edit-column"> <input value="Save" type="submit"></td>
                </tr>
            </form>

            <form action="" method="post">
                <input name="anchor" value="61484" type="hidden">
                <tr class="row" id="61484">
                    <td class="activity-data">61484</td>
                    <td class="checkbox"> <span style="display:none;">1</span> <input name="signed" type="checkbox" checked > </td>
                    <td class="edit-column"> <input value="Save" type="submit"></td>
                </tr>
            </form>

        </tbody>
    </table>

</div>

JavaScript

$(document).ready(function() {
    $("#accTable").tablesorter();

    // :checkbox stops from executing the event on the save button. Same as input[type=checkbox]
    $('#accTable input:checkbox').click(function() {
        // insert 1 or 0 depending of checkbox state in the tag before the input tag. In this case <span> is before <input>
        // this is done so tablesorter have something to sort on, as it doesn't support checkbox sort out of the box.
        var order = this.checked ? '1' : '0';
        $(this).prev().html(order);

        $(this).parents("table").trigger("update");
    });
});

// sends the form content to server side, and stay on page
$('form').live('submit', function() {

    alert('test');

    // don't redirect
    return false;
});
  • 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-25T16:07:18+00:00Added an answer on May 25, 2026 at 4:07 pm

    You can’t put a form into a tbody so when the table gets sorted, the inputs are getting pulled out of each form and put into separate rows outside of the form.

    You can wrap the entire table in a form and give each button a name to identify which row is being submitted. JSfiddle: http://jsfiddle.net/JQ6qF/2/

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

Sidebar

Related Questions

If you look at this JSfiddle http://jsfiddle.net/littlesandra88/G3N4m/ you will see that I have input
Made a fiddle for this: http://jsfiddle.net/terjeto/MN4FJ/ My problem is that dragleave fires when you
I want something that looks like this http://jsfiddle.net/mazlix/VBzau/3/ But I don't want to have
If you check this: http://jsfiddle.net/QbMmX/1/ Then you can see that the box(div element) is
Say I have something that looks like this: http://jsfiddle.net/Dtsjh/ How do I align the
Please see this http://jsfiddle.net/yv8uw/1/ When you click View all Comments the box opens up
In this jsfiddle http://jsfiddle.net/littlesandra88/eGRRb/ have I submit buttons that are auto-generated. Each table row
I got the following problem. I have a design similar to this jsfiddle: http://jsfiddle.net/k3EUx/
See this jsfiddle for example: http://jsfiddle.net/FrJRA/1/ and note that the inner span's border overlaps
i have this: http://jsfiddle.net/uAQ8B/5/ This list should have all the objects on the left

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.