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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:48:00+00:00 2026-06-12T20:48:00+00:00

I cannot figure out why this isn’t working, it was working fine last week

  • 0

I cannot figure out why this isn’t working, it was working fine last week and now it isn’t. I figured I must have mistakenly changed something, but after going over the whole thing, I couldn’t find anything. So, I’m wondering now if my code wasn’t very good in the first place. Here is the delete.js file:

function deleterecord(form)
    {

    var checkBox = document.edit.checkbox;
    var lenBox = checkBox.length;
    var foundBox = false;

    while( lenBox--> 0 )
        {
            if( checkBox[lenBox].checked === true )
                {
                    foundBox = true;
                    break;
                }
        }

    if( !foundBox )
        {
        alert("Please select a record to delete");
        return;
        }

    var r=confirm("Once deleted, these records are gone forever.\n\n Are you SURE you want to proceed? ");
    if (r==true)
        {
        form.submit();
        }
    else
        {
        alert("Phew! That was close!\n\n No records were deleted.");
        window.location.reload(true);
        }
    return;
    }

…and here is the html form:

<form action="process_delete.php" method="post" id="edit" name="edit">
<table cellpadding="4px" cellspacing="2px" border="1">

    <tr align="center">
    <td>Aircraft Reg</td>
    <td>Date Installed</td>
    <td>Prefix</td>
    <td>Part Number</td>
    <td>Flight Control</td>
    <td>Lat Position</td>
    <td>Long Position</td>
    <td>Vert Position</td>
    <td>Location</td>
    <td>Material</td>
    <td>OEM/PMA</td>
    <td>Select</td> 
    </tr>

    $result = mysql_query("SELECT * FROM installed $filter ORDER BY aircraft_reg , part_number, date_installed ASC");
    $pagerow = mysql_num_rows($result);
        if ($pagerow > 0 ) 
            {
            while($row = mysql_fetch_array($result))
                {
                echo "<tr>";
                echo "<td>" . $row['aircraft_reg'] . "</td>";
                echo "<td>" . $row['date_installed'] . "</td>";
                echo "<td>" . $row['prefix'] . "</td>";
                echo "<td>" . $row['part_number'] . "</td>";
                echo "<td>" . $row['flight_control'] . "</td>";
                echo "<td>" . $row['lat_position'] . "</td>";
                echo "<td>" . $row['long_position'] . "</td>";
                echo "<td>" . $row['vert_position'] . "</td>";
                echo "<td>" . $row['location'] . "</td>";
                echo "<td>" . $row['material'] . "</td>";
                echo "<td>" . $row['oempma'] . "</td>";
                echo "<td align=\"center\"><input type=\"checkbox\" selected=\"\" id=\"checkbox\" name=\"check_list[]\" value=\"" . $row['id'] . "\"></td>";
                echo "</tr>";
                }
            echo "<tr align=\"center\">";
            echo "<td colspan=\"12\"><input type=\"button\" value=\"Delete Selected\"  style=\"width:150px; height:30px;\" onClick=\"deleterecord(form)\"></td>";
            echo "</tr>";
            }
        else
            {
            echo "<tr><td align=\"center\" colspan=\"12\"><h2>No Records To Display</h2></td></tr>";
            }   
    </table>

</form>

I have tried different variations of the document.edit.checkbox; such as document.getElementById["edit"].checkbox; or document.getElementById["checkbox"]; but I’m not able to get it working. Here is a jsfiddle if that helps, and I removed the php bits and entered some sample values instead.
As you can probably tell I’m very new to Javascript, but I’m trying my best and would really appreciate any guidance you could provide.

  • 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-12T20:48:01+00:00Added an answer on June 12, 2026 at 8:48 pm

    You want to loop trough all checkbox elements, so you need to get them by their name:

    var checkBox = document.getElementsByName('check_list[]');
    

    Here is the updated fiddle

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

Sidebar

Related Questions

I have looked all over and cannot figure out why this code isn't working.
Maybe it's just late, but I cannot figure out why this isn't working. When
I have tried so many things, cannot figure this out, I am using this
I have this code and cannot figure out how it could be simplified via
This should be simple but I cannot figure it out. I have this very
I have this code: set_value(X,Value,[X/_|T],[X/Value|T]). set_value(X,Value,[Y/V|T],[Y/V|NewT):- X\=Y,set_value(X,Value,T,NewT). set_value(X,Value,[],[X/Value]). But I cannot figure out what
I cannot figure out this positioning problem in Firefox. It doesn't seem to follow
I cannot figure out why this doesn't work. It seems so simple. It should
I just cannot figure this out, it looks really simple but I'm relatively new
After loosing much sleep I still cannot figure this out: The code below (its

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.