0
I would like to know how I do a form validation so that do not leave the fields blank on mobile, I have done several modes, pc works but mobile did not work in any way, as I would do it?
<script language="JavaScript">
function ValidaSemPreenchimento(form) {
for (i = 0; i < form.length; i++) {
var obg = form[i].obrigatorio;
if (obg == 1) {
if (form[i].value == "") {
var nome = form[i].name
alert("Os campos chave é obrigatório.")
form[i].focus();
return false
}
}
}
return true
}
</script>
<form name="form" id="form" action="send.php" method="post" onSubmit="return ValidaSemPreenchimento(this)">
Can you show the code you’re using? Set also the default number you want to validate.
– Sergio
this one, edited the post !
– Leonardo Ribeiro
What is this property
.obrigatorio
? Is aid
orname
? where is the HTML(s) form(s)?– Sergio
the form is down friend, the point is I do not want to leave blank, do not send the email or pass page if you have any blank input from that page!
– Leonardo Ribeiro
Do not use stacksnippets unnecessarily, they are not to format but to execute js+css+html codes that do something, if not to do anything use normal markup. Read HELP (http://answall.com/help/formatting) and learn to follow what is said on it, don’t kick things around without being sure how they work. Take it as a constructive criticism.
– Guilherme Nascimento
@Leonardoribeiro adds more information to the question, as it is I still have doubts about what you want.
– Sergio