Ifthe"PANTONE" input field is filled in, the "LINEAT" field is automatically set to "52".
In PHP or JS
Hello, I've done an example solving your problem !!! Using only the javascript getElementById and selectedIndex functions. To test locally just run the following code in a browser, save it to a .html file and run it in your browser.
<!DOCTYPE html>
<html>
<body>
<h3>Pantone</h3> <input type="text" id="pantone" onkeyup="verificarSelect();"/>
<br><br>
<select id="lineatura">
<option value="volvo">SELECIONE</option>
<option value="volvo">52</option>
<option value="saab">42</option>
</select>
<script>
function verificarSelect(){
var lineatura = document.getElementById('lineatura');
var pantone = document.getElementById('pantone');
if(pantone.value != ""){ // Se o valor for preenchido, setar o SELECT para 52
lineatura.selectedIndex = 1; //Indice da opção 52
}
if(pantone.value == ""){ // Caso esteja vazio, selecionar alguma opção
lineatura.selectedIndex = 0;
}
}
</script>
</body>
</html>
To test remotely use: link
I hope I have helped!