Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How do I access a array checkbox with javascript? Also, I am creating the checkboxes within php. But I keep getting errors with the following code. Most of the html code is probably irreverent but I thought I would show it.

HTML

<h2>Pending CDISC Files</h2>
<table class="rounded-corner">
  <form class="tasks" method="post" name="form_list" action="homepage.php">
    <thead>
      <tr>
        <th class="topleft">ID</th>
        <th>Family ID</th>
        <th>Wave</th>
        <th>Status</th>
        <th>Comments</th>
      </tr>
    </thead>
    <tr>
      <p>
        <td>
          <input style="width:15px" type="checkbox" id="update" name="update" value="0"/>
        </td>
        <td style="display:none">
          <input class="noneditable" style="width:20px" type="text" id="id" name="id" size="2" value="1" readonly="readonly" />
        </td>
        <td>
          <input class="noneditable" type="text" id="familyid" name="familyid" size="4" value="1234" readonly="readonly" />
        </td>
        <td>3</td>
        <td>
          <select id="statusi" name="statusi" onChange="checkboxSetC(0)">
            <option value="P" selected="selected">Pending</option>
            <option value="RC">Received - Completed</option>
            <option value="RI">Received - Incomplete</option>
            <option value="RLO">Received - Lost by the Office</option>
            <option value="NRNP">Not Received - No Participation</option>
            <option value="NRLI">Not Received - Lost by Interviewer</option>
            <option value="NRNR">Not Received - Not Required</option>
          </select>
        </td>
        <td>
          <textarea id="comments" name="comments" rows="2" cols="15" onChange="checkboxSetC(0)"></textarea>
        </td>
      </p>
    </form>
  </tr>
  <tfoot>
    <tr>
      <td colspan="4" style="text-align:left">
        Click to update changes you have made. Only select records will be updated.
      </td>
      <td>
        <input type="submit" id="updatecdisc" name="updatecdisc" value="Update" />
      </td>

Javascript

function checkboxSetC(i) {
    eval("document.forms_list.update.checked = 1;");
    return false;
}

Also available through this jsFiddle

share|improve this question
I believe this is a duplicate of this: stackoverflow.com/questions/426258/…, if not, update your question. What are you trying to accomplish? – Matthew Lehner Sep 9 '11 at 5:40
And why are your form tags not outside the table. Right now the submit button does not belong to the form at all. – mplungjan Sep 9 '11 at 5:55

closed as not a real question by Lucanos, Lasse V. Karlsen Sep 9 '11 at 18:39

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.