Selecting and Deselecting Checkboxes using Javascript

I have an agent written to display a list of documents.

Each list item has a checkbox associated with it. The user should be able to select the desired documents and then produce a copy of the documents.

The list is categorized, similar to this:

  • Operation

    • Component
      • Action Item
      • Action Item
    • Component
      • Action Item
  • Operation

    • Component
      • Action Item

When the user selects an operation, I want all of the associated components and Action Items to be selected. I am using the following code to generate the checkboxes:

Print |<input type=checkbox name=| + sOperation+ | checked onClick=“javascript:selectAllOp(‘| & sOperation & |’);”>| + sOperation + ||

In the selectAllOp javascript function, if the user is selecting the operation, then I want to select all the associated items. Same with unchecking an operation.

Print “”

Print “”

Print “function selectAllOp(fieldname)”

Print “{”

Print |var f=document.forms[0];|

Print |alert(fieldname);|

Print |f.A-Preparation for Integration.checked = true|;

I am actually using a field name to test - but I get an error on the source code line:

A - Preparation for Integration

Does anyone have any advise on how to set something like this up? Any help would be greatly appreciated. Thanks in advance.

Subject: Selecting and Deselecting Checkboxes using Javascript

Used the following in my selectAllOp function:

Print |eval(“f.” + fieldname + “.checked=false”);|

Now, just got to focus on deselecting the appropriate items!