0
I created a table with 2 input type radio, where one receives the value="Ok" and the other the value="Não Ok" and just ahead an observation column.
$tabela1 .= '<td style="float:center"> <input type="radio" name= "Sim['.$y.']" value="Ok" required></td>';
$tabela1 .= '<td style="float:center"> <input type="radio" name= "Sim['.$y.']" value="Não Ok" required></td>';
$tabela1 .= '<td> <textarea type="text" class= "Observacao" name="Observacao['.$y.']" rows="2" cols="30"></textarea></td>';
The inputs type radio are mandatory. Now always intended that the input type radio received the value="Não Ok", required the completion of the input of the observation, but only oblige in that situation.
thus obliging to fill in the
input observacaoboth fill the radioOkorNão Ok– Bruno
Dude, you can check the browser console for javascript and put a breakpoint to check the field value (
$(this).val()) is coming correctly and if he is entering theifright. In case it’s all right change.attr('required', 'false')for.removeAttr( "required" )in Else.– Gabriel Queiroz Schicora