Javascript uncheck all checkboxes with <input type="checkbox" name="QuoteRequiredServices[]" syntax
<pre><code>&lt;label class="checkbox inline"&gt;
&lt;input type="checkbox" name="Services[]" value="service1"&gt; Service 1
&lt;/label&gt;
&lt;label class="checkbox inline"&gt;
&lt;input type="checkbox" name="Services[]" value="service2"&gt; Service 2
&lt;/label&gt;
</code></pre>

<p>I am using Services[] so that $_POST['Services'] is mapped to an array in PHP, containing the values required. </p>

<p>However, on the client side I also need to uncheck all these checkboxes after the form has been submitted (to PHP). Fairly simple Javascript: (actual checkbox group is 8 long).</p>

<pre><code>for (j=0; j&lt;8; j++){
fields[6][j].checked=false;
}
</code></pre>

<p>where:</p>

<pre><code>fields[6] = formob.Services[];
formob=document.forms["FooterQuote"];
</code></pre>

<p>The problem is that I cannot put Services[] into a Javascript array. I have tried using the following methods: (pseudo-code, only syntax matters here)</p>

<pre><code>var fields=[formob.text1, formob.text2, formob.text3, formob.Services[]];
//Syntax error at Services[]

var fields=new Array(formob.text1, formob.text2, formob.text3, formob.Services[]);
//Syntax error at Services[]

var fields=new Array(formob.text1, formob.text2, formob.text3);
fields.push(formob.Services[]);
//Syntax error at Services[]
</code></pre>

<p>So, unfortunately I can't push Services[] into a Javascript array, as far as I can tell. </p>

<p>I have also tried using formob.Services instead, and this doesn't work either. </p>

<p>Has anybody got any ideas how I can make the name="Services[]" syntax for checkboxes work in a Javascript array, so I can cycle through and uncheck them all? :)</p>
