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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:59:23+00:00 2026-06-15T17:59:23+00:00

My application allows you to track orders in a store database. This database contains

  • 0

My application allows you to track orders in a store database. This database contains a weak entity used for notes which is attached to an orderID. I want to allow users to be able to apply to same ‘note’ to many orders at the same time, but there are some fields in the notes table that are dependent on the location of the sale. In other words, you should only be allowed to apply the same note if all the sale locations are the same.

Simplified View:

@using (Html.BeginForm("Create", "Note", FormMethod.Get, new { name = "editForm" }))
{
    <table id="DataTable">
        <tr>
            <th>
                <input type="button" value="Edit" onclick="checkboxValidation()"/>
            </th>
            <th>
                @Html.DisplayNameFor(model => model.OrderID)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.location)
            </th>
        </tr>
@foreach (var item in Model)
{   
    <tr >
        <td>
            <input type="checkbox" name="ids" value="@item.orderID" />
        </td>
    <td>
        @Html.ActionLink(item.OrderID.ToString(), "Details", "Search", new { orderID = item.orderID.ToString() }, null)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.location)
    </td>
    </tr>
}
</table>

checkboxValidation() is a javascript function I wrote to check if at least 1 checkbox is checked. How would I add a check to make sure all of the locations on checked lines are the same? Is this even possible? Thanks

EDIT: I missed a detail. When clicking the edit button, if the check is successful, it submits the form, which brings up the notes editor.

  • 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-15T17:59:24+00:00Added an answer on June 15, 2026 at 5:59 pm

    Should be fairly straightforward using JQuery:

    // find all the checked rows
    var checkedItems = $("#DataTable").find("tr td input[type=checkbox]");
    
    // construct a locations array for all checked items
    var locations = [];
    checkedItems.each(function(index, element) {
        if ($(element).is(":checked")) {
            locations.push($(this).closest("td").next("td").next("td").text().trim());
        }
    });
    
    // confirm each location is the same
    var valid = true;
    locations.each(function(index, element) {
        if (index > 0 && locations[index-1] != element) {
            valid = false;
            return;
        }
    });
    

    One additional thing you might want to do, is add some data tags to your tr and td elements, so that you can write more robust selectors that won’t break with a minor UI re-arrangement (like tr[data-role=check] and tr[data-role=location], etc).


    (Using JQuery closest and and JQuery each.)

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

Sidebar

Related Questions

I have built a Ruby on Rails application (2.3.9) which allows users to track
My new MVC3 web application allows users to store some information about themselves, and
I wrote an application which allows people to contribute plugins to extend the functionality.
I have an application that allows the user to download a csv. This works
I have a web service which allows the users to upload and keep track
I have three tables in a MySQL database used in a music library application:
I have built a Ruby on Rails application that allows users to track their
I have built a Ruby on Rails (2.3.8) application that allows users to track
I have developed a web based application which allows a client/user to upload a
I want to develop an application that allows me to track website visitors. I'm

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.