<?php
<SCRIPT LANGUAGE="JavaScript"><!--
function codename() {
if(document.Tipo.Tipo.value="1"){
document.formname.nome.disabled="disable";
}
else {
document.formname.nome.disabled="enable";
}
}
//-->
</SCRIPT>
<html>
<body>
<form action ="registoDois.php" Method="post" align="center" name="formname">
<table align="center">
<td class="float-right">Tipo de conta:</label></td>
<td>
<select name="Tipo" id="Tipo">
<option value="">Tipo:</option>
<option value="1">Aluno</option>
<option value="2">Professor</option>
<option value="3">Admin</option>
</select>
<tr>
<td class="float-right">Nome:</label></td>
<td><input type="text" placeholder="Bruno" id="firstname" name="nome" /></td>
</tr>
</table>
</form>
</html>
</body>
?>
I have a dropbox and an input text in a form that should disable according to the selection in the dropbox. For example if the user selects "Aluno
" with the value "1
" the javascript should disable the input text "name
" from user input, but if the user selects another option from the dropbox the input text name is enabled.