I'm trying to make a section of a form only appear if you choose "Attorney" from the radio button options. Sadly, it doesn't like me much and isn't working. Here is my code for the moment, in it's simplest form:
When I select one of the radio options, IE it comes up with an error that says "Object Expected" up where I'm calling the onClick event in the radio button elements.
I'm sure it's something stupid, but if anyone could please take a look and help, it would be much appreciated.
Code:
<script language="JavaScript" type="text/javascript">
<!--
function displayForAttorneys( attorney ) {
if (attorney) {
document.getElementByID("forAttorney1").display=block;
document.getElementByID("forAttorney2").display=block;
} else {
document.getElementByID("forAttorney1").display=none;
document.getElementByID("forAttorney2").display=none;
}
}
//-->
</script>
<form name="add" action="<? print $current_url; ?>" enctype="multipart/form-data" method="POST">
<table cellpadding="0" cellspacing="1" style="border:0;padding:2px 2px 2px 2px;">
<tr><td><b>Add New:</b><br><input type="radio" name="cp_attorney" value="1" onclick="displayForAttorneys(1)" /> Attorney
<input type="radio" name="cp_attorney" value="0" onclick="displayForAttorneys(0)" /> Staff</td></tr>
<tr><td>
<div id="forAttorney1" style="display:none"><b>Practice Areas (Attorneys Only):</b><br><span style="font-size:10px">Hold down control to select more than one option.</span><br>
<select name="cp_staff_practice_areas[]" size="5" id="cp_staff_practice_areas" multiple disabled>
<? print cp_staff_display_practice_areas(); ?>
</select></div>
</td></tr><tr><td>
<div id="forAttorney2" style="display:none">
<b>Primary Focus (Attorneys Only):</b><br>
<select name="cp_staff_primary" id="cp_staff_primary" disabled>
<? print cp_staff_display_practice_areas(); ?>
</select></div>
</td></tr></table>
When I select one of the radio options, IE it comes up with an error that says "Object Expected" up where I'm calling the onClick event in the radio button elements.
I'm sure it's something stupid, but if anyone could please take a look and help, it would be much appreciated.