Hi Robert,
Try this:
function checkDaBoxes(){
for (i=0; i<document.test.checkgroup.length; i++){
if (document.test.checkgroup[i].checked &&
document.test.checkgroup[i].value == 'bob')
alert("Its Bobby")
}
}
Paul.
On 17/06/2008, at 10:28 PM, Imperial, Robert wrote:
> Hello folks,
>
>
>
> Trying to get my head around how to find a specific value of a
> checkbox
> that has been checked here but I'm not getting it just yet. Below is
> what I've been playing with trying to figure out the correct syntax to
> pull this off. I only want to see if "bob" is checked then do some
> other
> processing based on that. What I have here obviously doesn't work the
> way I hoped it would as it pops the alert no matter which one is
> checked. TIA
>
>
>
> <form name="test" action="dump.cfm" onsubmit="return checkDaBoxes();">
>
> <input type="checkbox" name="checkgroup" value="bob" />
>
> <input type="checkbox" name="checkgroup" value="tom" />
>
> <input type="checkbox" name="checkgroup" value="mary" />
>
> <input type="submit" />
>
> </form>
>
>
>
> <script type="text/javascript">
>
> function checkDaBoxes(){
>
> for (i=0; i<document.test.checkgroup.length; i++){
>
> if (document.test.checkgroup[i].value == 'bob')
>
> alert("It's bob")
>
> }
>
> }
>
> </script>
>
>
>
> Bob
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3757
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15