1
I have a form that contains some checkbox that when they were marked I wanted to be assigned the value 1 to do the Insert on the server, I’ve seen how to check if it is marked, using Document.getElementByInput, but I assign the tag with the value Vaccine the value of 1 for example ?
Follows the code:
  <form id="Form" method="post" action="php/novoFilhote.php">
        <fieldset id="fieldset2">
        <input id="raca" placeholder="Raça" type="text" />
        <br />
        <input id="mae" placeholder="Mãe" type="text" />
        <br />
        <input id="pai" placeholder="Pai" type="text" />
        <br />
        <input id="preco" placeholder="Preço" type="number" />
        </fieldset>
        <br />
        <fieldset  id="fieldset2">
        <label>Nascimento    </label><input id="nascimento" placeholder="Nascimento" type="date" />
        </fieldset>
        <br />
        <fieldset  id="fieldset2">
        Doente: <input id="doente" name="item" type="checkbox"/>
        </fieldset>
        <br />
        <fieldset  id="fieldset2">
        Vacinado: <input id="vacina" name="item" type="checkbox"/>
        </fieldset>
        <br />
        <fieldset  id="fieldset2">
        Vermifugado: <input id="vermifugado" name="item" type="checkbox"/>
        </fieldset  id="fieldset2">
        <br />
        <fieldset  id="fieldset2">
        Vendido: <input id="vendido" name="item" type="checkbox"/>
        </fieldset  id="fieldset2">
        <br />
        <fieldset  id="fieldset2">
        <input name="MAX_FILE_SIZE" value="102400" type="hidden">
        <input id="image" accept="image/jpeg" type="file">
        </fieldset>
        <br />
        <button class='button2' type="submit">Enviar</button>
    </form>
    </fieldset>
</div>
    </div>
</div>
<script>
function verificaChecks() {
    var aChk = document.getElementsByInput("checkbox"); 
    for (var i=0;i<aChk.length;i++){ 
        if (aChk[i].checked == true){ 
            //Aqui eu teria que atribuir '1'
            alert(aChk[i].value + " marcado.");
        }
    }
}
</script>