Questions tagged [validation]

Validation is used to check data to make sure it fits whatever required specifications are set for it.

Filter by
Sorted by
Tagged with
3
votes
1answer
119 views

Validating proper input

Verifying the user's input is almost always required, even in really simple apps such as console calculator. Due to the wide variety of scenarios where this is useful I decided to make a few classes ...
27
votes
2answers
22k views

Password checker in Python

Using Python 2.7.12 I wrote a simple little script, psk_validate.py, that prompts the user for a potential password and checks if it has upper and lower-case ...
6
votes
2answers
58 views

Checking for many alertable conditions before saving customer information

What's the best way to refactor this code? The method does a lot of checking before showing an alert. And the method is too long for my taste. I'm thinking of extracting the checkers into their own ...
4
votes
2answers
525 views

Validating Shift class through builder pattern

I have a Shift class that looks like this: ...
3
votes
0answers
67 views

Initialising numerical properties from a text-based properties file

This is a Spring Framework-based datasource instantiator which reads its properties from the Spring Framework context, i.e. the values are initially all String from ...
18
votes
7answers
15k views

Checking if each char in a string is a decimal digit

I had to write a program that would verify that a string contains any digits beside numbers 0-9 and the first '-' sign to indicate if pos/neg. The algorithm works like I want it to, but is there a ...
11
votes
2answers
582 views

C library for standard input operations with data validation and error check

I have implemented a C library to perform basic input operations on built-in data types with various error checks of more complexity. Any improvements or suggestions are appreciated. GitHub ...
3
votes
1answer
64 views

Triggering on form submit

In my HTML, I have a large form (id ="myform") that asks users to fill in 5 fields for Date of Birth (DOB), Sex, Weight, Hair Color and Eye Color and then several other fields which don't relate to ...
6
votes
1answer
2k views

Credit card validation - Python 3.4

Just completed a piece of code - a credit card validation program in python - as a little side project. Having no experience with classes in the past, I decided to employ classes in this project. I ...
6
votes
3answers
2k views

User input validation that might be unbreakable for C++

I am new to programming and have been having a lot of trouble with user input validation. Everything I found online I could break and I finally put this function together that appears to be ...
2
votes
2answers
88 views

Writing a date checker in C

I'm currently working on writing a date checker function in C and wondering how it can be improved upon. Q: Write a function that is passed a month, day, and year and will determine if that date ...
1
vote
2answers
1k views

Program that reads a string from the keyboard and tests whether it contains a valid date

I know this task could be done in more practical ways, but the professor only want us to solve it with the "if" statement. I tested and it meets the condition for each task, but I still feel this code ...
3
votes
1answer
1k views

Validator for mathematical expressions in infix notation

The function belows validates if a mathematical expression, say 12 + 2 * (9 - 3) / 4, does not have operators that are next to each other. It returns ...
-1
votes
1answer
428 views

Javascript to PHP email validation? [closed]

So I'm working on an application where Javascript will first validate the email using a regex and then once sent to PHP, PHP will verify the user did not modify any of the javascript and validate the ...
4
votes
1answer
70 views

Excel VBA object with validated bounds for an interval

I'm working through a problem I have with Excel VBA. I have two object classes. Class clsLoadStep stores three copies of class clsLoad objects. Class clsLoad simply stores a value and a string stating ...
2
votes
1answer
112 views

Library to verify GTINs of various lengths

I'm writing a library to verify GTINs (GTIN-8, GTIN-12, GTIN-13, GTIN-14) and calculate their check digits. The calculation of the check digits don't differ from type to type, so I can use the same ...
5
votes
1answer
235 views

Validating input variables

I have written the following JavaScript code and want to ask if it is written as per best practices. Please recommend any changes to be made in the code. The code is taking a few variables as input ...
1
vote
1answer
89 views

Validation form JavaScript

I am a beginner to JavaScript and I know about jQuery Validations however I do not want to use a foundation like jQuery just yet. I am wondering if what I have done its good or if there is another ...
2
votes
1answer
575 views

Instantaneous validation of form field length

Since I have a function which can be done in few ways as usual, I was wondering which way is the best to achieve the form validation where I have only one input field, and I am showing a warning on ...
8
votes
5answers
3k views

Validate input that maps int to enum

I've written the following enum and have added a function, fromValue that allows the caller to map given int into the enum value. I was wondering if the ...
2
votes
1answer
61 views

Parse the response from http call and populate multiple maps

I have to parse a response after making HTTP call on the server. If the response is not successful then try another server otherwise parse the successful response and populate two ...
0
votes
3answers
62 views

Opening and validating an XML file

I have a section of code that repeats many lines and I am looking to refactor this code possibly so that a function can be used instead of the same lines of code each time. Below is the section of ...
5
votes
2answers
130 views

Validation sequence

...
2
votes
3answers
199 views

Function to check if a date is correct

I have a method that checks if a date is correct or not, which returns a boolean if it is or not. In the method, I first check the format, then the date by using the function ...
0
votes
2answers
83 views

Validate particular id's depending on what process type is coming

I have code where I validate deviceId and clientId basis on what ProcessType is coming: <...
2
votes
0answers
193 views

IE8 Form Validation

I am writing a custom form validation script compatible with IE8+. I just wanted to make sure I am not messing anything up. I have tested on IE8 its works. However, I want to make sure I am doing it ...
1
vote
1answer
446 views

TypeScript JSON-Array Validator

For my latest app I wanted to be able to code the front-end first, without having to do super extensive documentation and without forgetting my data types later on while coding the back-end. I thus ...
1
vote
0answers
1k views

ValidationAttribute to validate a string against a JSON schema

This is my implementation of an .NET ValidationAttribute to validate a string against a JSON schema. The JSON schema file is stored within the application as an ...
3
votes
2answers
522 views

Validation Extension method performance

I'm writing a simple set/framework of extension methods for argument/parameter validation. What I'm mostly concerned about, ATM is the performance, against the simpliest boilerplate ...
4
votes
1answer
383 views

One time key for authentication

In a recent project I was to create a web service that would be consumed by another application. One of the requirements was to have a key in the service that authenticated the request as valid. But ...
5
votes
4answers
4k views

Asking the user to input a proper email address

The purpose of this code is to ask the user to input an email address but it must contain "@" and ".co". The code works but it is too long so I would like to know if there is any way to shorten it ...
2
votes
1answer
114 views

Adding various types of configurable validators to fields

I am currently reworking our entity code generator, that uses JaxB for schema validation, and Stringtemplate for code generation. As we are giving our professional service the possibility to add ...
6
votes
1answer
6k views

Unit tests for React component to submit an input form with validation

I'm very new to front-end/unit testing and have been having a difficult time understanding the point altogether, but I managed to push my way through testing literally everything I could possibly ...
1
vote
0answers
97 views

Ajax Validation Handler

I'm trying to transition my app from a collection of server scripts to something that uses SOLID concepts. I'm stuck trying to figure out a better way to do ajax validation. I currently have a file ...
0
votes
1answer
252 views

Patten matching to check for non-empty argument list

I'm learning Elixir. while building a trivial cli application (as seen here http://asquera.de/blog/2015-04-10/writing-a-commandline-app-in-elixir/) I'm defining a module that implements a ...
2
votes
1answer
2k views

Custom checkbox validation on submit

I have the code below which is working as expected. It is doing a form validation with Vue.js and Vee-Validate. It is checking that at least one checkbox is checked. I only don't like that I have to ...
4
votes
2answers
143 views

Validation for registration password

Could someone tell me if this is a bad idea for coding my validation for a password and it is bad? This is for registration for my site. Could you please tell me why and how you would go about it (I ...
2
votes
2answers
133 views

Method for validating properties based on passed conditions

I wrote a method for validating properties based on passed conditions. It works well, but declaration takes more space than the actual condition. Is there any way to make it shorter? ...
1
vote
0answers
50 views

Validating each process object from its own validator

I have two processes, and for each process, I will get different GenericRecord object (this is an open source classes) and I need to validate those ...
4
votes
1answer
80 views

Perl module validate quoted string literal, test with Test::LectroTest

I guess for some motivation: I ripped this out of a larger library I'm half-working on to parse S-expressions and cleaned it up a bit. I'm trying to write a simple function that tests whether a ...
6
votes
3answers
153 views

Weekday+day validation

The string I'd like to check is something like "abcSun24def". If any valid "xxxyy" (xxx = weekday and yy = day) is found, return the position inside the string. If "xxxyy" is not found, return -1. ...
0
votes
1answer
119 views

Validation on two different classes and passing one object including everything to another class

I have two consumers and each consumer has their own validation logic entirely different from one other so I am using two validator class for that, one for each other. ...
22
votes
10answers
4k views

Verifying a person's age

When coding I noticed I started to get into a habit of not using if-else statements when the else block only has one line of code. For example, if I have code that can be solved like this: ...
4
votes
1answer
119 views

Validate the inputs and perform actions accordingly

I have a consumer which is listening to Kafka and from which I am getting avro GenericRecord. Now basis on GenericRecord ...
2
votes
1answer
3k views

PHP Validate JSON objects with a JSON schema

I have a basic JSON API written in PHP. I want to validate incoming JSON data. I know there are PHP JSON validators out there, here is a quick one I just rolled up. ...
0
votes
1answer
52 views

Validating only attributes that are present in a form [closed]

I want to skip validations based on attributes. If certain attributes are not in form so I do not want to validate them. Currently, if I post them from one form which has 1 field, it still validates ...
2
votes
1answer
33 views

Single Validation function, called once per Animation function

Just looking for a way to include a single validation function inside of another function, that will stop any other lines from executing if it fails. NOT an if statement... I'm trying to avoid ...
1
vote
2answers
1k views

Validator Class in PHP

I am trying to create a validation class that can be used to validate many forms of my webpage in general. It makes use of the database as well to verify records. The problem with it is that it ...
5
votes
3answers
4k views

Custom exception for string that is too long

This is my first time working with Java exceptions. I have made a program that works to specifications, but I am wondering if there is anything I've done which is unconventional or not recommended. ...
2
votes
0answers
61 views

Expression validator service

I'm working on a project (in C++98) that uses a grammar validation service to validate mapping expressions for a small DSL. To simplify the project code, I've written a small interface for using the ...