Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
0answers
37 views

When to use required params validation [closed]

I have below function in my project (in Yii2), which i am using to resize the images. ...
0
votes
1answer
55 views

Password and confirm password validation in Android Studio

I just wrote this password and password confirmation validation code function that checks to see if a password is empty or not, and is it match (password = confirmPassword). I'm not sure this is the ...
16
votes
7answers
2k views

Program to check if a date is valid or not

I am a novice programmer and am currently learning Python programming by myself through a book. I stumbled upon a question in a chapter and it took me 2 days to figure out a solution for it. Although, ...
2
votes
1answer
29 views

Finding incorrect yml headers

Introduction I am working on a semi large project with a few hundred files. In this project there is a series of lesson.yml files I want to check is formatted correctly. And, yes, every file I want ...
3
votes
1answer
72 views

Convert string to double and check for errors

The following program converts a string to a double, and checks for errors. It uses the strtod() function to do the conversion, and follows the example given for ...
0
votes
0answers
46 views

Candidate registration, with validation, using MVVM

I am new to MVVM. I Created Model class CandidateRegisterModel and ViewModel class CandidateRegisterViewModel ...
0
votes
2answers
46 views

jQuery function to display an alert when submitting blank fields

I am new to jquery and implemented following function in a js file in case of error- ...
2
votes
1answer
77 views

PHP contact form script

I have created a contact form that originally did not have any mechanism for sending out the email with whatever the user inputted in the fields. I have added it in here along with ReCaptcha check. I ...
5
votes
2answers
209 views

Apple receipt validator

I'm working on a solution for validating Apple receipts. Here's the repository as whole. I based it mostly on the gdx-pay-server library. In my implementation, one of the classes I want to improve is <...
1
vote
0answers
45 views

Form validation for multiple inputs - react

I created an example of a simple form for multiple inputs (name and phone number) in React. If user enters invalid data in input field, error text is displayed near the same field. I learned a lot of ...
2
votes
0answers
44 views

Form validation for the last name | React

I created an example of a simple form for a last name input in React, where I can check the validation of the data at the time of input. The last name should contain only small and capital letters, ...
3
votes
4answers
93 views

Simplify form validation with function

In jQuery, I have been reluctant to create a better form validation, and I feel the time has come for me to do so. With that said, I have been using this particular type of form validation, and I ...
8
votes
2answers
287 views

Validating user-provided control points for a Bézier curve

I have made some code which will validate user input for getting 4 control points for a bezier curve. It works fine however I was just wondering If I could make this code any more compact or efficient?...
4
votes
1answer
58 views

Validator for vertices of a polygon

There is an object which has few properties. I wrote a function for test cases which check if the properties are satisfied or not. The function should throw an exception if the property is not ...
10
votes
4answers
324 views

Validator for mathematical expression in infix form

This program will validate whether a mathematical expression entered by the user is a valid expression based off whether the expression itself has been entered with the correct scope openers and scope ...
3
votes
2answers
68 views

Creating user accounts

I have a method which allows to create user account. It contains some conditions to control empty fields, wrong format of email, weak password, etc. ...
15
votes
6answers
5k views

Verifying IPv6 addresses

While trying to learn Python I stumbled upon a question which asks you to write a code that is able to take an input and verify it to see whether it meets the IPv6 Criteria. I wrote the following ...
5
votes
1answer
58 views

Basic input validation package in Lua

I'm very new to Lua (and programming in general). I wanted to start out with a simple package that validates input based on a set of rules. The code works as intended, but is what I have written is ...
2
votes
1answer
55 views

A basic form with React

I have been working of a basic from using React and I need your help to improve this part of my code, especially validate and ...
2
votes
1answer
93 views

Checking if all questions were answered with javascript

I made a quiz project and I made a code to see if all the questions were answered, using JavaScript. It works, but its way more exhaustive than I wanted it to be. I first check every single option ...
1
vote
0answers
227 views

CodeIgniter CRUD form validation

I've developed a crud "helper" of sorts. Fields/columns are derived from the database and contain everything from the name of the field to the type and size of the field. Part of the system integrates ...
1
vote
0answers
57 views

JSON validator using rules

I'm writing an application that is meant to validate data. The data comes in the form of JSON and I'm using JSON Schema to validate the structure and some of the logic along with functions to ...
1
vote
0answers
71 views

Using repository in a FormRequest in Laravel for custom business rule validation

This is my app/Http/Requests/Organisation/CreateOrganisationRequest.php ...
8
votes
2answers
1k views

Checking some rules before a Telegram bot replies to a message

So far, I've created a couple of programs, and the issue that comes up is how ugly and non-scalable they look. For example, currently I'm working on a telegram bot. Before replying to a message I ...
5
votes
2answers
1k views

Conditional validation on two input fields that depend on each other

My code consists of two input fields and a submit button. The business rules require the following rules: At least one field must be filled out. Both can be filled out but both cannot be blank. If ...
0
votes
0answers
221 views

Rails Strong Parameters Filtering

In my Rails controller with strong parameters, I have the typical my_model_params private function to filter out any "scary internet params". One of the parameters ...
3
votes
1answer
305 views

Credit card validator code in Python

I wrote a Python code that is validating Credit Card Numbers. Some of the advanced programmers told me my whole code is messy. How can I make my code cleaner? ...
3
votes
0answers
74 views

Define a class for latitude and longitude in C++ using boost::units and spheroidal coordinates

I am trying to write a class that defines latitude and longitude in C++ using boost::units and normalized spheroidal coordinates. I want to throw an exception if ...
0
votes
0answers
66 views

Handle and validate general input under certain constraints

I have been programming in C++ for less than six months, so please correct anything you can. I think one of the most annoying things programmers have to deal with is validating user input. For ...
3
votes
2answers
376 views

JSON Schema Validation helper method

This is what I wrote to validate JSON to the given schema. ...
3
votes
1answer
88 views

Function to validate data using up to four kinds of rules

Sometimes I end up with a function that requires checking multiple conditions to determine the outcome and the logic can get to be too much to handle on a single line. Here's an example of how I ...
2
votes
1answer
2k views

Server side validation for reCAPTCHA V2 or Invisible reCAPTCHA with Java (Servlet)

The main reason for this post is that I spent quite a lot of time searching the easiest way to validate recaptcha V2. So I'm going to share my knowledge to avoid further time wastage of developers. I'...
1
vote
1answer
50 views

Ensure multiple steps work/saving multiple models via a service

I just thought of something new re: saving multiple objects in Rails (though Rails is not necessary). Objectives: Create an author and a tomato, but both of those must be valid. If invalid creation, ...
2
votes
3answers
292 views

Integer validation in C++

I am studying C++ and after I learned about some functions of the library cctype like isdigit I decided to make a program that ...
1
vote
0answers
126 views

A rails controller needs to validate certain values exist

I need to pass some values from a CMS to a rails view. I should check these values are defined in the CMS. These values are meant to be use in all pages, hence the use of ...
-1
votes
1answer
34 views
-3
votes
2answers
102 views

Check if a variable is one of a set of valid strings [closed]

We need to check if a given variable is either "get" or "post". If it's neither then I should throw an error. My teammate and I ...
21
votes
6answers
5k views

Validating Yes/No answers in C++

I intend to accept all of the following answers: y Y yes YES Yes plus mixtures, such as yeS, yES, which I didn't intend to accept but it's a consequence of my code the same applies to No and its ...
2
votes
3answers
129 views

Validation of Identification card fields (string and array)

I am validating two variables of an Identification card (cedula in the code). The first one is a string and the second is an array. My inputs are: 1- e.g. ...
3
votes
2answers
184 views

Is it possible to make this PHP code shorter?

I need help with this code. How can I make it shorter? How can I create an array with the names, for example, errors, and modify code without so many If statements? ...
2
votes
1answer
52 views

Validating list of values to be sent to API

I'm currently writing a client library to use with a courier's SOAP API to create and manage shipments. I'm using the service classes generated from the WSDL provided by the courier, their ...
3
votes
1answer
91 views

Custom exceptions for validating movie information

I wrote my first application about custom exceptions and catching them. Here is the GitHub link. I Have 3 types of custom exceptions: TimeException (validate time: hours, minutes) MovieException (...
0
votes
1answer
232 views

Inputs equality check using jQuery without plugins

I tried creating a function to check for a match between two email fields, let's say EMAIL and CONFIRM email. I absolutely try to avoid jQuery validate. It is not worth it for a single field. For the ...
1
vote
1answer
97 views

jQuery looping on fields after validation

I have the following code: ...
4
votes
1answer
154 views

Simple form validation module

Thinking about form validation, I just wanted something simple that works and is extensible. I came up with the following code, which expects a list of selectors that maps to one or more functions ...
-1
votes
2answers
112 views

Verifying that all fields of a unit has been suitably filled in

I have unit class which have some properties, and I have acceptancePolicy table which contain values. If values (from one row) are true method should return true. The method is below. How can I ...
13
votes
6answers
2k views

Simple object validator

I wrote a simple validation tool that allows me to quickly define validation rules and check my data objects against them. I know there is this another tool called FluentValidation but... I'm not a ...
1
vote
2answers
111 views

C# - exercise - object validation - reflection - generics - follow-up

Here's a C# class as an example for object validation. For this purpose I decided to use .NET reflection and tried to use generics, probably not in the correct way, that's why I'm writing this post. I ...
2
votes
2answers
101 views

Two methods to prompt the user to enter the width and length of a rectangle

I have two similar methods for setting dimensions of a rectangle. At first, I had them combined into one longer method that set width and length. I read about keeping code modular that performs one ...
2
votes
3answers
632 views

C# - exercise - object validation - reflection - generics

Just published (GitHub) a C# example for object Validation, for this purpose I decided to use the .NET Reflection and tried to use Generics. I would really like to improve coding, can you please give ...