| Author |
Clearing checkboxes
|
Chris Garrison
Ranch Hand
Joined: Jun 13, 2002
Posts: 44
|
|
I have a form that contains several radio buttons and checkboxes that correspond with the radios. For instance: (radio) Supreme Pizza <checkbox> no onions <checkbox> no sausage <checkbox> no cheese .... (radio) Meat Lovers Pizza <checkbox> no sausage <checkbox> no canadian bacon... and so on. You select Supreme Pizza initially and select the "no onions" chechbox. But then you change your mind and click the MeatLovers. The radio button is reset correctly but how can I automatically clear the "no onions" checkbox from the Supreme Pizza? Thanks for you help.
|
May the force be with you, always.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
basically you are going to have to make a function to clear all of the resets for all check boxes on the page when they click the button. document.FormName.checkboxname.checked=false; basically you can make a look and look through each one document.FormName[checkboxNameVariable].checked = false; Need more help just give a hollar... Eric
|
 |
Chris Garrison
Ranch Hand
Joined: Jun 13, 2002
Posts: 44
|
|
Thanks Eric, I thought I could figure it out but I'm stumped (and new to script) here is some code -i'm sure its something simple. As I understand it - when you click on the radio button (named "item") it runs the ClearCheckBoxes fuction - which should set all checkboxes (check1, check2 ...) to off. Why isn't it working? NOTE - i cut a lot of table formatting stuff out so you wouldn't have to sift through it. Thanks [ May 26, 2004: Message edited by: Chris Garrison ] [ May 26, 2004: Message edited by: Chris Garrison ]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
your form name is order so An easier way to do it would be See if that helps you out. Eric
|
 |
Chris Garrison
Ranch Hand
Joined: Jun 13, 2002
Posts: 44
|
|
I think I'm close but I keep getting an error "document.order.a'is null ornot an object". What am I doing wrong? Thanks for your help [ June 01, 2004: Message edited by: Chris Garrison ] [ June 01, 2004: Message edited by: Chris Garrison ]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
add quotes around all of the words in your array a[X]="blah"; also change this document.order.a[yy].checked=false; to document.order[a[yy]].checked=false;
|
 |
Chris Garrison
Ranch Hand
Joined: Jun 13, 2002
Posts: 44
|
|
Excellent!!! Thanks!!! Halleluia!!
|
 |
 |
|
|
subject: Clearing checkboxes
|
|
|