Forum Moderators: coopster

Message Too Old, No Replies

Radio Buttons disabled

Using the checked property causes my radio buttons to be disabled

         

surfmore

1:29 am on Mar 16, 2005 (gmt 0)

10+ Year Member



I am causing my radio buttons to be either checked or unchecked based on a data value. When the page loads the radio buttons are disabled and I can't unselect them. Any help would be great.

Thanks

code example...

<?php
if($mobilephone <> "")
{
echo '<input name="mobile" type="radio" checked>';
}
else
{
echo '<input name="mobile" type="radio">';
}
?>

coopster

1:56 am on Mar 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Radio buttons are supposed to have a default selection made by default [w3.org]. To be able to "unselect" the choices means that one would not be selected, thereby breaking the "rules". If you really want the ability to leave something unselected, look into the checkbox [w3.org] instead.

surfmore

2:38 pm on Mar 16, 2005 (gmt 0)

10+ Year Member



Thanks it's working with the checkbox.