2
I’ve done it with the radio button, but I’m having trouble doing it from a select. When selecting any employee, you must enable and when you select that you represent no employee, you will disable the button.
<form action="questao2.php" method="post">
<fieldset>
<select>
<option name="ativo" value="--" onchange="if(document.getElementById('avancar').disabled==false){document.getElementById('avancar').disabled=true}"/> --</option>
<option name="ativo" value="FUNCIONARIO1" onchange="if(document.getElementById('avancar').disabled==true{document.getElementById('avancar').disabled=false}"/>FUNCIONÁRIO 1</option>
</select>
<button id="avancar" type="submit" disabled="disabled" class="btn btn-primary pull-right" >Avançar</button>
</fieldset>
</form>
<form action="teste.php" method="post">
<fieldset> Sim ou não? <label class="radio">
<input name="ativo" type="radio" value="SIM" onclick="if(document.getElementById('avancar').disabled==true){document.getElementById('avancar').disabled=false}"/>SIM</label>
<label class="radio">
<input name="ativo" type="radio" value="NAO" onclick="if(document.getElementById('avancar').disabled==true){document.getElementById('avancar').disabled=false}"/>NÃO</label>
<button id="avancar" disabled="disabled" class="btn btn-primary pull-right" type="submit">Avançar</button>
</fieldset>
</form>
<form action="questao2.php" method="post"> <fieldset> <select> <option name="active" value="-" onchange="if(Document.getElementById('advance'). disabled==false){Document.getElementById('advance'). disabled=true}"/> --</option> <option name="active" value="FUNCIONARIO1" onchange="if(Document.getElementById('advance'). disabled=true{Document.getElementById('advance'). disabled=false}"/>EMPLOYEE 1</option> </select> <button id="forward" type="Submit" disabled="disabled" class="btn btn-Primary pull-right" >Forward</button> </fieldset> </form>
– fabricio_wm
Can you put the radio button code? Better than doing it one by one it’s better to create more general code that works for many elements. But for that you have to put the whole code relevant to this question.
– Sergio
<form action="test.php" method="post"> <fieldset> Yes or no? <label class="radio"><input name="active" type="radio" value="SIM" onclick="if(Document.getElementById('advance').disabled==true){Document.getElementById('advance'). disabled=false}"/>SIM</label> <label class="radio"><input name="active" type="radio" value="NAO" onclick="if(Document.getElementById('advance').disabled==true){Document.getElementById('advance'). disabled=false}"/>NO</label> <button id="advance" disabled="disabled" class="btn btn-Primary pull-right" type="Submit">Next</button></fieldset> </form> Obrg @Sergio
– fabricio_wm