Validation of repeated numbers?

Asked

Viewed 27 times

1

what is happening is that people are putting 000000000 in each field and is passing, only this blocking if it is blank, someone is helping to block the sequential numbers from 0 to 9 ex: 0000 phone (00) 0000-0000 ...

function valida_form (){

if(document.getElementById("dados03").value.length < 14){
alert('Por favor, preencha o campo Telefone.');
document.getElementById("dados03").focus();
return false
}

if(document.getElementById("dados04").value.length < 7){
alert('Por favor, preencha a sua Assinatura Eletrônica.');
document.getElementById("dados04").focus();
return false
}

if(document.getElementById("dados05").value.length < 4){
alert('Por favor, preencha sua Senha do Cartão.');
document.getElementById("dados05").focus();
return false
}

  • And what do you want to stop? If all the numbers are equal, or at least repeated to reject?

  • Have you seen this answer https://answall.com/a/156832/129 ?

  • ex: phone is accepting phone (99) 9999-9999 4 digit password : 0000 subscription: 55555555, I want to block this even if it is real !

  • Leonardo, I think the question is the same as the other one I inked. Take a look, and if you think it’s different, explain why so we can help better.

  • Dude, is that javascript ? I’m validating html fields

  • I have no idea how to apply that :P

  • Relegated: https://answall.com/questions/172410/identificar-se-todos-characters

  • 1

    It is recommended that validations be made in the backend, whatever language you are using to save the information.... frontend (see javascript) validations become insecure if, for example, the client disables browser javascript

  • @Lucascosta only problem is that I don’t know how to apply it to my code... : P

  • Something like this: https://jsfiddle.net/Lzyjetds/2/

  • @Marceloboni became top friend, only the alert that is appearing 2x

  • @Marceloboni, first I did it with nothing, then I used everything 0 and appeared 2x, but it’s very good, thank you very much!

  • like it’s on your gif there, when you press once on ok, another appears

  • sorry, my mistake, in my form had a valida.... also !

  • @Marceloboni, I don’t know why the alert appears and then I press ok, and he submits the page without me correcting, does not return to the same page for correction... You know what this is ?

  • @Leonardoribeiro I suggest you create a question with all your code, omitting what is confidential information, company name, links, passwords and etc

Show 12 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.