Kind of a weird thing. I think maybe you could just simplify it and use a boolean. That should guarantee success, unless you need the actual count later in the script.<br><br>Milo<br><br><div><span class="gmail_quote">On 1/4/06, 
<b class="gmail_sendername">Cutter (JS)</b> &lt;<a href="mailto:java.script@seacrets.com">java.script@seacrets.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
OK, strange one here. Writing some custom form validation scripting on<br>some dynamically created forms. Currently I have a form where a user can<br>delete files from the system. They have the ability to check a checkbox
<br>(name='deletefiles' value=[filename]) for each file they wish to remove.<br>When the form is submitted a formValidate() function is called and, in<br>this instance, an isRequiredCheckbox(fldObj) function is called. This is
<br>to verify that at least one selection has been made. This works great if<br>there are multiple files (which, in turn, means more than one checkbox),<br>but doesn't work properly when there is only one file (and one<br>
checkbox)? Below is the basic code affected. Any ideas would be appreciated.<br><br>Cutter<br><br>//first of all you must know that the fldObj object has a property<br>'FieldName' that is the form field object<br>// as in 
fldObj.FieldName = document.forms.myform.mycheckboxfield;<br>function isRequiredCheckbox(fldObj){<br>&nbsp;&nbsp;&nbsp;&nbsp;valCheck = 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;selChoices = -1;<br>&nbsp;&nbsp;&nbsp;&nbsp;for (counter = 0; counter &lt; fldObj.FieldName.length; counter++){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (fldObj.FieldName[counter].checked) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selChoices = selChoices + 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;if (selChoices &lt; 0){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert('You have not made any selections.');<br>&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; valCheck = 1;
<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;return valCheck;<br>}<br>_______________________________________________<br>Javascript mailing list<br><a href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</a><br><a href="https://lists.LaTech.edu/mailman/listinfo/javascript">
https://lists.LaTech.edu/mailman/listinfo/javascript</a><br></blockquote></div><br>