Most voted "validation" questions
Validation is used to verify data and ensure it meets certain specifications.
Learn more…357 questions
Sort by count of
-
65
votes6
answers66144
viewsType of the CPF or CNPJ field in the VARCHAR or INT database?
What type of CPF or CNPJ field in the database VARCHAR or INT? I’ve seen some posts suggesting using INT to optimize performance in the event of JOINand filters. If you have 0 the left is only…
-
55
votes5
answers20362
viewsIs there an algorithm to check the validity of a ID number in Brazil using check digits?
Is there an algorithm to check the validity of a RG number in Brazil using check digits, as with the CPF? If yes, how is this algorithm?
-
51
votes8
answers2113
viewsIs using customer validation enough?
Using Javascript validations is sufficient for efficient validation? Example: Date validation. It is necessary to check also in the code? What are the disadvantages of only performing validations…
-
32
votes7
answers58283
viewsRegular expression for e-mail validation
I am trying to create a regular expression to validate any e-mail, I wrote the expression below, but it is not working as expected: var parse_email = /^[a-z0-9.]+@[a-z0-9]+\.[a-z]+\.([a-z]+)?$/i;…
-
29
votes3
answers660
viewsShould we validate function parameters?
In languages like Java, method parameters are "validated" in the build (at least the type): public void facaAlgo(String str) { // ... } // em algum outro lugar: int i = 2; this.facaAlgo(i); // erro…
-
27
votes3
answers128363
viewsNumber of characters of CPF, CNPJ and RG
I’m doing a program that needs to validate a number of documents - CPF, CNPJ and, if possible, RG. My questions are as follows:: Are there valid Cnpjs with fewer than 14 characters? (ex: old…
-
23
votes3
answers59486
viewsHow to compare dates in PHP?
I would like to know which function I use to compare two dates and return to larger. I have a form for HR registration in which the user will register their professional experiences and the date of…
-
19
votes2
answers5784
viewsHow to validate a Brazilian civil name?
How to validate people’s names, in Brazilian Portuguese?
validationasked 10 years, 11 months ago talles 11,434 -
18
votes3
answers8119
viewsWhat are the best practices in field validation?
I created an example to illustrate my doubt regarding field validation, the example is composed of two classes Pessoa and ModelPessoa. The class Pessoa has the following attributes: Nome, Idade,…
-
16
votes2
answers898
viewsAre business rules always related to validation?
Since I started studying object orientation I hear a lot about business rules. Basically, from what I understand until today, an object must have methods encapsulated the rules of business and the…
-
15
votes2
answers5421
viewsHow to validate each data type received from a form?
This subject has several related topics, and generates as many back and forth, each with a different answer. In some cases we have great answers, but no specific question about this question (in the…
-
14
votes1
answer137
viewsRFC6530 - Check if variable contains a well formatted PHP email address
Approval adopted by the Gmail as published in Official Gmail Blog, and as defined in RFC 6530: Assuming a function valida_email() that would return boolean: echo valida_email("té[email protected]"); //…
-
14
votes4
answers994
viewsWhy does Input Type Email validation accept pointless domains?
The input type[email] is intended to validate whether the field is being filled with a valid email. But several times I have gone through questioning in some projects about why this field accept…
-
12
votes5
answers14658
viewsHow to validate date taking into account leap year?
How to validate leap year date in Javascript?
-
11
votes3
answers25097
viewsHow to validate jQuery Validator mobile and landline number?
I need a method of validation of landline and mobile phone with the jQuery Validator plug-in. The differentiation of numbers from fixed to mobile is important to validate the sending of SMS.…
-
11
votes3
answers347
viewsDifference between validation and mask
I am making form validations. As for validation, everything goes well, but how to format the fields according to the data entered? Example: in a date field, bars are added automatically, in a phone…
-
10
votes8
answers7818
viewsCheck if variable contains a well formatted PHP email address
The variable receives a value that is supposed to be an email address, but doubts arise: It will be an email address, random text, or anything else? Being an email address, it is well formatted?…
-
10
votes3
answers265
viewsW3C HTML validator accuses "Empty Heading"
I’m trying to validate my html and it’s giving me the following message: Line 328, Column 34: Empty heading. <h3 class="titulo-chamada">A internet no controle</h3> He hinted that the…
-
10
votes1
answer383
viewsValidation configuration in dynamic fields
I have a problem which is this, I have the fields: Name, Age and Text; In a part of the system I register that the Text field will only appear if the Name field is equal to PH and the Age field have…
-
8
votes1
answer3364
viewsValidate decimal numbers in Javascript
What is the simplest and correct way to validate a Javascript decimal number? For example, how to implement a function IsNumeric that has the following test cases: IsNumeric('-1') true…
-
8
votes2
answers3639
viewsValidation of digital signature
I am developing a software integration with the legal note webservice for issuance of electronic tax notes of the city of Porto Alegre. After some difficulties I was able to fine tune the xml so…
-
7
votes3
answers8251
viewsUsing jQuery Validation Engine and CNPJ validation
I am using the jQuery Validation Engine with this file of translations into Portuguese. I added in Javascript the following line: "cnpj": { "regex": /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/,…
-
7
votes3
answers254
viewsWhy validate even with a default value
When I’m preparing something, however simple it may be, the question always arises: I must trust the mine code? This puzzle is usually associated with the fact that "tomorrow" may not be me…
php exception validation software-engineering encoding-styleasked 9 years, 12 months ago Zuul 35,190 -
7
votes4
answers6781
viewsWhy does my CNPJ validation pass this invalid value?
I have a problem with a JS validation, in case it does not pass any invalid CNPJ value, but when typed only 000.000.000/0000.00 it lets pass normally. function ValidaCNPJ(cnpj) { var i = 0; var l =…
-
7
votes2
answers1353
viewsWhat can the Model do to validate the MVC?
In an MVC project developed in PHP, I should validate what in model and what in controller? Hash of passwords I’m doing in the method set of the classes model. Certain validations that are not…
-
7
votes2
answers335
viewsHow to verify that the document markup is HTML5?
I am creating a plugin and need to know if the document is written in HTML5 or not. I thought I’d use the document.doctype, but I don’t know what to compare it to since I compare it to '<!DOCTYPE…
-
6
votes1
answer1009
viewsWhat is the difference between `filter_var`and `filter_input`?
What’s the difference between filter_var and filter_input? I can’t find it anywhere, at least not in a way I understand. And how can I replace mysql_real_escape_string by one of them? $password =…
-
6
votes4
answers3497
viewsHow to prevent the user to enter numbers for a given data?
How do I make my Java program not accept numbers as given by the user? I would like, in a field that requires the user name, if a number is inserted, such as a badge, make the program ask again for…
-
6
votes3
answers72
viewsPage does Submit even with validation error
Hello, I’m having trouble with a page because it’s doing Submit even when validation returns false. $("#botao1").click(function() { $.ajax({ url : 'adicionadaIdeia', type : 'POST', async : false,…
-
6
votes1
answer775
viewsMandatory field rule should be on the backend or frontend?
I’m building an application where the backend is an API and the frontend is Angular2. In a user’s registration I do a validation in the API and if a required field is not filled in the API returns…
api validation encoding-style software-engineering angularasked 7 years, 12 months ago Diego Zanardo 3,301 -
6
votes1
answer4628
viewsWhat is the difference between Sanitize and filter in PHP?
Making a safety class for PHP I noticed the existence of two similar constants, like: FILTER_SANITIZE_NUMBER_INT and FILTER_VALIDATE_INT. The standard follows in validations of email, string and…
-
5
votes1
answer550
viewsHow do I validate an email field on Dart?
I created a simple project in Dart whose intention is to validate an e-mail field when a button is clicked, showing an error message. However, the function Regexp.hasMath is always returning false.…
-
5
votes5
answers24461
viewsUsing jQuery Validation Engine and CPF validation
I am using jQuery Validation Engine with translation file for English. I added the following line to Javascript: "cpf": { "regex": /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/, "alertText": "* CPF…
-
5
votes2
answers6374
viewsString comparison
There are several ways of comparison, but I always see that the most suitable are (===, strcmp ou strcasecmp). Among these forms presented considered the safest (according to some websites on the…
-
5
votes2
answers5706
viewsPassword check
Hello, I’m starting to learn Javascript and I’m not being able to validate my code if there are 3 characters in uppercase, 2 numbers and 1 special character in my input. I would like to know what I…
-
5
votes1
answer777
viewsData formatting works on Chrome and does not work on Internet Explorer, or vice versa, with MVC C#
If I wear the model [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd'/'MM'/'yyyy}")] public DateTime data { get; set; } Works perfectly on I.E. but doesn’t work on Chrome. When…
-
5
votes2
answers2657
viewsRegex to pick sequence of equal numbers
I need to do a validation using regex, how do I validate if a string is coming with repeated numbers? for example "1111","2222","3333"
-
5
votes1
answer4227
viewsVariable validation required if
'tipo' => 'required', 'cpf' => 'required_if:tipo,F|cpf', 'rg' => 'required_if:tipo,F', 'cnpj' => 'required_if:tipo,J|cnpj', 'inscricao_estadual'=> 'required_if:tipo,J', Next, I’m…
-
5
votes1
answer3305
viewsHow do I uncheck the previous radio button after selecting another one?
I have five radio button, of these five one is "marked", as I do to unmark the radio button that I clicked after clicking on another? Example: <fieldset>…
-
5
votes1
answer362
viewsWhat is the best validation strategy before data persists?
I’m used to . NET using C# and Entityframework. And there in the Entity we have the dataanotations. When I create the entity in C#, for example person, just put the datanotaations and the Entity…
-
5
votes3
answers203
viewsShould I always use Try catch to fix mistakes?
Sometimes when I know something may fail in my system I do a validation using if, equal is below: lista = [1,2,3] #um número que esteja entre os indices da lista numero = int(input(f'Digite um…
-
4
votes1
answer405
viewsCompare two date attributes in the database with two Textbox
How can I compare a range of two dates? data_Inicio date data_Fim date textbox_inicio textbox_fim I can do this on the ASP.NET side and the goal is that my start date will never be less than my end…
-
4
votes3
answers249
viewsHow do you make sure the person who used the system is really her?
At the university where we are studying, we are developing a system in Java EE to reduce bureaucracy in some enrollment processes, extinguishing forms and generating PDF forms that, instead of going…
-
4
votes2
answers5046
viewsHow to validate Google reCaptcha / noCaptcha in PHP?
How to send such POST that Google asks and so make my field validated?
-
4
votes2
answers468
viewsCheckbook batch sum, total value and validation
Write a C program to validate a batch of checks. The program should initially request the sum of the batch and the number of checks. Next you should read the value of each check by calculating the…
-
4
votes3
answers1676
viewsUse HTML5 form validation next to Jquery
I need to validate a form using the browser property required. Only that there is a problem, my Submit button does not stay on the form. It has to stay out, and when I click on it I call the…
-
4
votes1
answer1282
viewsRegular expression formatted as internet domain
How to create a regular expression to validate an internet domain? The rules are below: Minimum size 2 and maximum 26 characters; Valid characters are letters from "a" to "z", numbers from "0" to…
-
4
votes5
answers16658
viewsinput only numbers with jquery
I have a function that validates typed characters and does not let the user use special characters but this same function does not work for numbers, someone knows some function in jquery to validate…
-
4
votes2
answers2610
viewsDate and time validation
How do I make so that in the date field, is not saved a date that has already passed, for example yesterday and in the time field is not typed an invalid time, for example 27:00, only the Brazilian…
-
4
votes1
answer2009
viewsIs there any way to validate an input in Angularjs without using form?
I have a input which I wish to validate via Angularjs. However, this input is not within a form. So, when trying to access the form validation information, I was unsuccessful: <div…