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

UnChecking a single radio button

 
Songezo Nkukwana
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a dynamic list of radio buttons created at run time. This list can be anything from 1 (1 Item and its Radio button). But my javascript seems to only cater for 2 or more radio buttons. My attempt is to uncheck a selected radio button when a clear button next to each radio is clicked.



This only works when the list of Radio buttons is more than 1 (the for loop) ... btngrp is a property of a form bean declared as String radioButtons passed as: onclick = "unCheckRadio(radioButtons ); " ... Is there a better or working way to solve this problem when only a single Radio button is created?
 
Songezo Nkukwana
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Songezo Nkukwana wrote:I have a dynamic list of radio buttons created at run time. This list can be anything from 1 (1 Item and its Radio button). But my javascript seems to only cater for 2 or more radio buttons. My attempt is to uncheck a selected radio button when a clear button next to each radio is clicked.



This only works when the list of Radio buttons is more than 1 (the for loop) ... btngrp is a property of a form bean declared as String radioButtons passed as: onclick = "unCheckRadio(radioButtons ); " ... Is there a better or working way to solve this problem when only a single Radio button is created?


oops! btngrp.checked == false; should be btngrp.checked = false; ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic