Oh, I thought this was obvious, but maybe not. Replace "form" with the name
of your form or with forms[x] where x is the number of the form on the page.

On Mon, Feb 9, 2009 at 3:02 PM, Michael Grant <[email protected]> wrote:

> Whoops, I think that should be "i<form.elements.length"
>
>
>
> On Mon, Feb 9, 2009 at 3:01 PM, Michael Grant <[email protected]> wrote:
>
>> You're going to have to loop through form.elements and count them. Note,
>> this isn't tested and just off the top of my head. Can't remember if you
>> refer to id as "id" or "id.value", you might have to mess with it a bit. On
>> another note it's generally bad to have multiple elements with the same id.
>>
>> var iCount = 0;
>> for(var i=0; i<form.elements;i++) {
>>    if(form.elements[i].id == "updateFirmware") iCount++
>> }
>>
>> alert(iCount);
>>
>>
>>
>>
>> On Mon, Feb 9, 2009 at 2:50 PM, Tony <[email protected]> wrote:
>>
>>>
>>> i want that alert to tell me how many checkboxes with the
>>> id="updateFirmware" there are.
>>> its telling me that fields is null :(
>>>
>>> help.
>>>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>>> <html xmlns="http://www.w3.org/1999/xhtml";>
>>> <head>
>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>>> <title>Untitled Document</title>
>>>        <script type="text/javascript">
>>>                var fields = document.getElementById('updateFirmware')
>>>                alert(fields.length);
>>>        </script>
>>> </head>
>>>
>>> <body>
>>>
>>>        <form name="peripheralForm" action="tony.cfm" method="post">
>>>                Test
>>>                &nbsp;
>>>                <input type="checkbox" id="updateFirmware" />
>>>                <br />
>>>                Test
>>>                &nbsp;
>>>                <input type="checkbox" id="updateFirmware" />
>>>                <br />
>>>                Test
>>>                &nbsp;
>>>                <input type="checkbox" id="updateFirmware" />
>>>                <br />
>>>                Test
>>>                &nbsp;
>>>                <input type="checkbox" id="updateFirmware" />
>>>                <br />
>>>        </form>
>>>
>>> </body>
>>>
>>> </html>
>>>
>>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:287835
Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5

Reply via email to