Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radio button alert based on state of checkbox

Status
Not open for further replies.

cyberbob2

Programmer
Nov 13, 2003
32
US
Hello, I am trying to throw an alert from the onClick event of a radio button based on the "checked" state of a checkbox. I am testing with several dynamically created checkboxes, which start out empty but the user then clicks. If they don't click one, they should not be able to delete the record. Here's the function I've been working with. Any help would be greatly appreciated. Thanks in advance. Bob.

function deleteMessage()
{
var is_checked = window.document.form1.racknowledge.checked;
if (is_checked == true){
(confirm("This confirms that you have acknowledged this message. Are you SURE you want to delete this message?"))
alert("Your message will be deleted.");
document.form2.submit();
return true;
}else if (is_checked == false){
alert("You cannot delete a message if it has not been acknowledged!");
document.form2.reset();
return false;
}
}
 
is "racknowledge" the radio button? is there more than one button named "racknowledge"?

if so, you need to use array notation, like
var is_checked = window.document.form1.racknowledge[0].checked;


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top