I'm building one cordova application that uses one tag form with a submit button, the problem is that this is one mobile application, so when a click on my text input, write something and than click on confirm button of my mobile keyboard, my problem happens. Because when I click on this button, I want to move to the next input, but my aplication execute my submit method. What I have to do to my application pass to the next input and if, and only if this is my last input, so verify if all input are filled.
This is my html code:
<form id="form">
<label for="idNome"> Nome: </label> <input name="nome" id="idNome"
placeholder="Seu Nome" required autofocus autocomplete="on"><br>
<label for="idCpf"> CPF:</label> <input type="tel"
autocomplete="on" name="cpf" id="idCpf" placeholder="Seu CPF"
required> <img style="display: none;" id="idValidadeCPF"
src=""><br>
<label for="idEndereco"> Endereço:</label>
<textarea id="idEndereco" rows="1" cols="30"></textarea><br>
<label for="idMensagem"> Mensagem: </label><br>
<textarea cols=30 id="idMensagem" rows="10" name="mensagem"
maxlength="500" wrap="hard"
placeholder="Informe datalhes sobre o seu problema." required></textarea><br>
<input type="submit" value="Enviar" onclick="submitForm()" />
And this is my submitForm method
function submitForm(){
document.getElementById('form').onsubmit= function(e){
e.preventDefault();
alert("Todos os campos devem ser preenchidos");
}
}