Choose which input to submit [closed]

-2

Good afternoon, I'm looking for help developing a form like this: in the form it will have some type fields: a select asking if the product has a serial number or not. If it does not have serial number it leaves the input with value predefined sn and if it has serial number it enables the field to enter the number. In this case the input field only appears if you have serial number. Thanks in advance. I'm developing in php.

    
asked by anonymous 03.10.2018 / 20:27

1 answer

0

What you want is something for javascript

function simNao(option) {
    document.getElementById("qqum").style.display = "block";
        if (option.value == "sim") {
            document.getElementsByName('qqum')[0].placeholder='Digite o número de série';
        } else if (option.value == "nao") {
            document.getElementById("qqum").value = "sn";
            document.getElementById('qqum').readOnly = true;
        
        }else{
          document.getElementById("qqum").style.display = "none";
       }
    }
<select onchange="simNao(this);">
    <option value="">Possui numero de serie?</option>
    <option value="sim">Sim</option>
    <option value="nao">Não</option>
</select>


    <input style="display: none;" type="text" id="qqum" name="qqum" value=""/>
    
04.10.2018 / 02:35