Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
6
votes
1answer
898 views

Auto-Format GPA while typing

I'm looking for a more cleaner and simpler solution to auto-format a text-box field intended only for the user to enter their college Grade Point Average (GPA). Here is my code: ...
3
votes
2answers
620 views

Simple structure that would contain validation errors messages

Before I go too far, does this look right? This is mostly to have a "central" place that hold a "hierarchical/structured" errors message. ...
19
votes
3answers
4k views

Credit card verification: string conversion most optimal?

Below is some code which verifies a credit card number using the checksum as well as check if number of digits are appropriate as well if digits start with right numbers. I am not sure if converting ...
10
votes
3answers
742 views

Conditionals validation for Tic Tac Toe

I have been working with Java for a little more than a year. I recently have built a Tic Tac Toe game as an assignment for my Java class. After my instructor graded it, he wrote a comment around my ...
6
votes
5answers
10k views

Validating that all open/close parentheses are correctly matched

It returns true for: a*(b+c) ()() (()) ((!!(123(x)))) and returns false for: ...
23
votes
4answers
2k views

Celsius → Fahrenheit conversion table

It's harder to do than criticize. Here's my attempt to implement a Celsius-to-Fahrenheit conversion table in C++. ...
3
votes
1answer
156 views

Credit card validation with reversed array

I want a review of this code. ...
6
votes
2answers
3k views

iOS App - Interface for user log in using a call to a web service API

I have a navigation controller set up with a user code and password and a log in button. When the user clicks on the Log In button or the return key on the keyboard on the password text box - the ...
3
votes
1answer
3k views

Validating an entity using a dynamic list of predicates

I have a generic extension method for validating my entities. The main idea is to be able to specify at runtime (context related) the criteria for validating a specific entity (with the end goal of ...
36
votes
3answers
9k views

Ensuring user input is an integer in a range

I have isolated a little bit of code that was causing a small debate between myself and another user. I have taken some of the things that he said and meshed it with the code that was being reviewed ...
5
votes
1answer
2k views

Date range validator

I have some code which works fine. First, it checks that dates format are valid and then, checks that first date is lower than second date. I had to use free input text and custom validator because ...
28
votes
6answers
9k views

Matching a generated string of random letters to an input

I made a program in Python and wanted it to be faster, so I wrote it on C# because it's compiled. To my surprise, the Python program is much faster. I guess there is something wrong with my C# code, ...
2
votes
2answers
767 views

Select validation

Is there any way to make that code shorter? I still want to use jQuery. I don't want to use any validation script. ...
2
votes
3answers
2k views

Validating the presence of properties in a document

How can I reduce cyclomatic complexity of validation and refactor it better way? ...
6
votes
3answers
2k views

JS validation and submission with AJAX

I've got an assignment to do pure JS validation as well as submit with AJAX. Here is the code I've got so far. I'm wondering if I can do away with the whole "reason" bit. That was because it was ...
9
votes
4answers
9k views

Password checker in PHP

I have written a password checker using PHP, consisting of many if else statements. Is there any possible way to shorten this code? ...
5
votes
2answers
1k views

jQuery wrapper of Parsley.js

In a project, I have a lot of HTML forms without validation and I want to add a front end validation, in a quick way. I start looking for a library and I met Parsley.js. It's a good library, but if I ...
6
votes
1answer
6k views

Checking input and email field

I've written this as part of my contact form on my website. It checks to see if required inputs are empty, if so adds a red warning color and text. It also checks the email field for a properly ...
5
votes
1answer
620 views

Validating HTML Form

I am trying to create a simple validation for forms. I am almost there, but there are few bugs and optimization errors that I am really struggling with. I'm looking for advice on how to make this ...
7
votes
2answers
6k views

Spring password validator library

I recently got rejected at a job interview for submitting this: https://bitbucket.org/gnerr/password-validator The interviewer asked for a password validation library that was configurable via ...
6
votes
2answers
237 views

Simplifying this form validation script

Can anyone please help me to simplify this form validation script? It works great but I was just wondering if I can get some help to make it simpler. Your opinion on the approach I used below is ...
53
votes
5answers
36k views

Verifying password strength using JavaScript

I have a function which verifies the "Password" field and suggests the user to enter a strong password. I also have a label named "Password Strength", referring to the strength of a password (very ...
7
votes
3answers
2k views

Simple MPG calculator in Python

I am a self taught coder taking a Programming Fundamentals class to work towards a degree. It's based on Python, which I'm not as familiar with as other languages. I added error handling like I would ...
26
votes
6answers
25k views

Validating opening and closing bracket pairs

I have refactored one of my old homework assignments (mainly to utilize std::stack and some C++11), and I'm still having trouble making it less repetitive. It ...
3
votes
1answer
433 views

Reading and validating 2D matrix bar code

I need a review on this. This code will read a 2D matrix bar code, which I hard-coded as a string str. It has "]d" starting string, which is a GS1 International ...
10
votes
2answers
15k views

Checking if a string matches an array of valid characters

I am wondering what a better solution would be for this bit of code: ...
2
votes
1answer
144 views

A class for form data validation

I don't want any feedback on the regexes as I know what needs to be updated here. Also, don't need any feedback on naming conventions. I'm looking for feedback on the structure and correctness of ...
8
votes
2answers
174 views

Inputting and displaying strings

I have written some code for one of my assignments. However, I feel that I am repeating myself slightly in a few places. I have that niggling feeling that there is a better way to do things. Here ...
7
votes
2answers
484 views

Am I implementing BDD correctly?

I'm writing a utility that validates fields. I decided to try my hand at Behaviour Driven Development (BDD). The validator utilises "rules" to determine if field is valid. Three different types of ...
3
votes
1answer
278 views

Class for file creation and directory validation

After reading some texts regarding creation of files under Python, I've decided to create this class which creates a new file on a directory, and creating a backup on the other directory if the file ...
4
votes
2answers
9k views

Validating email without Regex

I'm trying to improve my JavaScript (I'm usually a copy/paste guy but can do basic DOM stuff with jQuery too), so I decided to try and make a function to validate an email address without using Regex. ...
1
vote
3answers
2k views

Rails validating with condition block

Rails AR. validate one field, with 4 validators & 2 condition block ...
1
vote
2answers
109 views

Displaying alerts for blank fields

I'm trying to make my code easier to understand by making it more correct and maintainable. Here's the code I'm trying to simplify: ...
10
votes
2answers
701 views

Monad transformers in C# for use in validation

I am working on using monad transformers in C#. I would like to know if the following code I present, shows that I have understood this. I am fairly new to this so any feedback / comments are really ...
3
votes
2answers
403 views

JavaScript form validation: improve on 'good, but not good enough'

I recently received a 'good, but not good enough' rating on a coding exercise I was asked to perform. It was to validate that if "Product complaint" option was selected that Product name, Product size,...
5
votes
5answers
1k views

Most efficient way to validate multiple textboxes against a tolerance value

I have a series of text boxes in a table to gather input as below: The user will input a target and actual value for each measurement point they require. I would then like to validate the actual ...
7
votes
4answers
2k views

Shorter way of prompting for a height of x feet y inches?

I'm currently working on a BMI calculator and just wondered if there was a shorter or more condensed version of doing the if validating statement. I have currently ...
3
votes
1answer
46k views

Simple code to check format of user inputted email address

I am helping a friend with her Java homework and I adapted a solution I used in a similar project of my own for this. It is supposed to use loose/generous regex to make sure an email entered matches ...
3
votes
4answers
229 views

Dealing with non-required user input

I'm working on a page where a user can create new records, but not all values are required. When creating the SqlCommand with potentially null values, I'm wondering what's the best way, from a code ...
1
vote
3answers
169 views

Verifying patterns of various filenames

I have a large number of images that were named in a odd way and because of that, when they're displayed in a file browser, they're completely out of order. However, since they weren't named in a ...
2
votes
2answers
179 views

Redundant email checking in PHP

This essentially checks if any of these if statements are true, then echos a statement. Unfortunately, wrapping the error message with a ...
1
vote
2answers
9k views

Validating uploaded images

I have attempted to write a method that checks that images being uploaded are valid. ...
1
vote
2answers
113 views

Form validation for sporting events

I am coding a site where users submit sporting events. When submitting an event there are a lot of fields that need to be validated. This is the method I wrote to valid the fields: ...
1
vote
1answer
209 views

Simplify jQuery validation

I wrote a script for validate the input field for following requirements Not null Multiple of hundreds Less than needed amount Here is my script: ...
3
votes
0answers
663 views

Tiny MVC - Handling validation / sanitization in a model

I'm fairly new to MVC concepts and PHP input validation. I'm open to all input, but I'm largely wanting to know if the following: Follows the MVC pattern correctly - if not, how can I change it to ...
0
votes
3answers
7k views

Function to show or hide validation error messages

I'm a bit clumsy at writing JavaScript. I have some nice code like this: ...
3
votes
3answers
963 views

Validator classes

We're trying to design validation classes with a common interface. This would apply to all validators. We would define a validator interface with a ...
0
votes
1answer
4k views

Form validation - security and input specification

So I'm working on a register form and I have four fields: name, username, email and password. I pick up the values of these fields in jQuery and depending on if all the fields are filled, I pass them ...
2
votes
1answer
3k views

Different types of model validation

So we have a RESTful webservice that implements CRUD operations for a model, like this one: ...
11
votes
8answers
2k views

Check whether address criteria contain only certain fields or more

I have a method that checks whether an addressCriteria contains only certain fields or more. If it contains more fields, it should return false, otherwise true. I'...