[Wtr-general] checkbox list created by javascript

Andy Case Andy.Case at qsa.qld.edu.au
Wed Jun 28 22:11:58 EDT 2006


Hi,
 
I need to set a checkbox within a javascript, that creates a list of
people with Id's. I need to be able to set the checkbox associated with
an ID.
 
Anyone help?
 
 
HTML extract
 
<table>
<tbody>
</tbody>
</table>
 
</div></div><p></p>
 
  <script type="text/javascript" language="Javascript">
    function editStaff(staffid) {
      document.stafflistform.staffid = staffid;
      document.stafflistform.submit();
    }
 
    function ceaseStaff() {
      if (getCheckedCount(document.forms['stafflistform'], 'selection')
== 0) {
        alert('No staff were selected to be ceased.');
      } else {
        if (confirm('Are you sure you wish to cease selected staff?')) {
          return true;
        }
      }
      return false;
    }
 
    function deleteStaff() {
      if (getCheckedCount(document.forms['stafflistform'], 'selection')
== 0) {
        alert('No staff were selected to be deleted.');
      } else {
        if (confirm('Are you sure you wish to delete selected staff?'))
{
          return true;
        }
      }
      return false;
    }
 
    function getCheckedCount (formObj, fieldName) {
      var checkedCount = 0;
      for (var i=0; i < formObj.length; i++) {
        fldObj = formObj.elements[i];
        if (fldObj.name.indexOf(fieldName) != -1)  {
          if(fldObj.checked) {
            checkedCount++;
          }
        }
      }
      return checkedCount;
    }
  </script>
 
  
    
    <div>
      
    </div>
  <table class="header">
<tbody>
<tr>
<td><span class="page-header">Manage Staff Accounts</span></td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email (including any attached files) is for the intended 
recipient(s) only. If you received this email by mistake, please, 
as a courtesy, tell the sender, then delete this email.

The views and opinions are the originator's and do not necessarily 
reflect those of the Queensland Studies Authority. All reasonable 
precautions have been taken to ensure that this email contained no 
viruses at the time it was sent.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060629/aae172ac/attachment.html 


More information about the Wtr-general mailing list