Larry, your script works fine for me. I had to add some radio buttons
to test it, but it works as it should.
On 7/21/05, Larry C. Lyons <[EMAIL PROTECTED]> wrote:
> I'm having a problem with a javascript validation for a form with
> multiple checkboxes named the same. It works just fine when there is
> more than one checkbox, but, if there is only one it always validates
> to false and craps out. Any suggestions would be most appreciated.
>
> thx,
>
> larry
>
> Here's the javascript:
>
> <script language="javascript" type="text/javascript">
>
> function checkForNoSelections(){
>
> var chkd = 0;
> var e = document.viewItems;
>
> for(var i = 0; i < e.atccNum.length; i++){
> if(e.atccNum[i].checked == true){
> chkd = ++chkd;
> }
> }
> if(chkd > 0){
> e.submit();
> return true;
> }
> else{
> alert("You must select an item to display.");
> return false;
> }
> }
>
> </script>
>
> Here's the form:
>
> <form action="multiSelectTest.htm" enctype="multipart/form-data"
> method="post" name="viewItems">
> <input type="hidden" name="hiddenField" value="" />
> <input type="Checkbox" name="atccNum" value="1"> 1<br />
> <input type="button" value="View Selections"
> onClick="checkForNoSelections()"><br />
> <input type="Reset" value="Clear Selections"><br />
> </form>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:5:165821
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54