I am trying to disable a form field based on the what the user chooses in a drop down menu. I've asked on the CGI forum but was told to ask on the JAVA Script forum. I have server validation in place, but need to make sure that the client side is checked as well.
CGI CODE:
JavaScript Code:
Also, I get an error when the page is loaded and the user selects box type; Error:Object Expected
CGI CODE:
Code:
print "<tr><td>BOX:</td><td>";
print popup_menu({-name=>'boxType',
-values=>['--Select--','firBox','secBox'],
-onChange=>"chkIt('boxType');"});
print "</td></tr>";
print "<tr><td>Box Name:</td><td>";
print textfield('boxName','',25,25);
JavaScript Code:
Code:
$jScript=<<EOF;
<script language=JavaScript>
function chkIt(choice) {
if (choice == 1 ) {
document.theForm.boxName.disabled = true;
}
}
</script>
EOF
Also, I get an error when the page is loaded and the user selects box type; Error:Object Expected