Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clearing checkboxes

 
Chris Garrison
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent!!!

Thanks!!!

Halleluia!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic