Larry,
I don't know if you already solved this, but it appears that when
there is one checkbox, the notation e.atccNum[i] where i would be 0,
does not hold. Then you have to refer to it as e.atccNum alone.

HTH,
George

On 7/21/05, Larry Lyons <[EMAIL PROTECTED]> wrote:
> I'm having a problem with a javascript validation for a form with
> multiple checkboxes with the same name.
> 
> The validation works just fine when there is more than one checkbox (as with 
> a results set with more than one item) however, if there is only one 
> checkbox, it always validates to false and craps out. Any suggestions would 
> be most appreciated.
> 
> thx,
> 
> larry
> 
> Here's the javascript:
> 
> <InvalidTag 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 an example of the single checkbox form (there are no problems with 
> multiple checkboxes):
> 
> <form action="whatever.cfm" enctype="multipart/form-data"
>       method="post" name="viewItems">
> 
>    <input type="Checkbox" name="atccNum" value="1">&nbsp;&nbsp;1<br />
>   <input type="button" value="View Selections"
>        onClick="checkForNoSelections()"><br />
>   <input type="Reset" value="Clear Selections"><br />
> </form>
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212560
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to