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
1
vote
1answer
214 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
670 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
8k 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
974 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 ...
1
vote
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'...
1
vote
2answers
290 views

jQuery validation code

Would like some assistance in improving my jQuery validation code. I have some repeated code, but I am not sure how to write it in a way so that I don't have to keep repeating the same code over and ...
2
votes
1answer
138 views

Validator function in Backbone

I have inside a Backbone model validate function several if statements: ...
2
votes
1answer
2k views

Is there a faster way to get ASP.Net Validation messages in a Page or UserControl?

Edit: The method call discussed is a public extension method in a shared library. I'd like it to be safe for others to call. A little background: I'm maintaining an ancient system written in ASP....
1
vote
1answer
140 views

Basic form validation script

Is this a good form validation script? ...
1
vote
1answer
155 views

Validating Javascript Model

I'm looking to create a model in JavaScript. Here is an example of the code that I have so far: ...
-2
votes
1answer
801 views

An own approach to Angularjs validation

Introduction So i am building a SPA with AngularJS. The application provides a large number of <input> elements and can be seen as a huge form. However, i ...
1
vote
2answers
11k views

Form validation for zip codes

I have a function that I intend to use for validating zip codes and I wanted to know if my way could be made better. ...
3
votes
3answers
375 views

Exploitable holes in login script

This is my most recent login system I have been developing. It is working with Sessions. I want to know if I am doing well, if my code contains any serious exploits, and if my logic is correct. This ...
-1
votes
2answers
170 views

Checking whether a comment contains text

Is this code good for checking if the variable texto is empty or not? How would it be done with try and catch? ...
3
votes
1answer
2k views

Contact form that goes to multiple addresses based on drop down selection

I followed a tutorial to create a PHP contact form that sends to multiple emails depending on drop down field selection. Is it protected from spam/other dangers? Or is it basically wide open for bots ...
2
votes
1answer
6k views

My login with AJAX and PHP

In your opinion, do I need to do all these validations? I thought to do well and stay safe but it seriously raises the question if it isn't slower. jQuery ...
3
votes
1answer
207 views

Contact information validation

The scripts below, I've obtained through tutorials and edited the best I know how. It all works - but I'd like to place them in one, external script. If at all possible, I'd appreciate some help in ...
1
vote
1answer
182 views

Refactor function that returns a comma Operator to pass jsHint

Some background This functions does some business logic before submitting a "add to cart" form HTML ...
2
votes
1answer
2k views

Properly storing error messages and displaying them with OOP

I have a class that I am using to initialize a form for editing. Once the form is submitted, data validation is done through the setters of my class. Good or bad input will be set in order to re-...
1
vote
3answers
1k views

Checking address fields for presence of a Post Office Box

I'm just trying to learn how to write jQuery better so I wanted some smart peoples opinions. The code is checking the billing and shipping address fields to see if it contains a PO Box address by ...
1
vote
1answer
1k views

Form validation script

I have a simple form validation script. Could you tell me how I can improve this script (mainly regarding security)? HTML page ...
1
vote
1answer
140 views

Verifying column and line counts

I have created this simple code: For the size of an array with 2 values (n and m), verify if ...
1
vote
0answers
166 views

Data model with validation in haskell couple convoluted functions

So I'm curious about a few things that I did here design wise, as well as one space I'm sure I can be given improvements from real haskellers. The part I really think can be done better that I'm ...
7
votes
2answers
926 views

MembershipProvider with Entity Framework and IoC

I am using Castle Windsor as my IoC container and I registered it as a DependencyResolver to let the MVC framework know about it. With the Entity Framework I have ...
4
votes
1answer
2k views

Custom jQuery validation error messages

We have a rule that all of our validation messages must be in a summary, and thus the default "this field is required" doesn't cut it because the messages lose their context in a summary and therefore ...
8
votes
1answer
7k views

Validating a credit card

I recently created an extension which detects the type of credit card based on the numbers entered in and formats it. I am using Luhn Algorithm for validating credit card numbers and I am using jQuery ...
3
votes
1answer
18k views

HTTP URL validating

What do you think about this? ...
4
votes
4answers
1k views

UPC-A validation

I've just written a validation routine for a UPC-A, which ensures the check digit matches the given UPC number (according to rules I found on Wikipedia). Below is the code, what do you think? ...
3
votes
1answer
817 views

Database, User and Validator in PHP

Please review my classes and give me some advice to improve them. I have also put some additional questions in the code and I hope you can give me an answer for some of them. Database.php ...
7
votes
3answers
8k views

PHP Validation Class

I'm looking for advice and ways on making it better. Code ...
3
votes
3answers
1k views

Validating the value of a property of an object

This code snippet is intended for validating the value of a property of an object. The min and max range is supplied as an .xml file like Nhibernate .hbm files. Since the data-type of the property is ...
2
votes
3answers
203 views

Checking mobile SIMs

Can someone improve this code? I need to eliminate the for loop. ...
2
votes
2answers
1k views

Simple form validation

I would really like to hear how I can improve my form validator. Next, I want to refactor it into OO and learn a testing framework like Jasmine. Some things I know I could improve: Don't make it ...
5
votes
2answers
440 views

Validating a password format

How should I make this more Ruby-like or just "better"? ...
5
votes
2answers
6k views

Validation and Form classes

I have written Validation and Form classes in PHP. Validation class allow you to define the ...
0
votes
1answer
393 views

jQuery login code

How can I improve this? jQuery ...
2
votes
1answer
2k views

GUI-based credit card checker

How can I make this more readable, faster, and make the GUI more appealing? CreditCard class: ...
1
vote
5answers
106 views

Solving an unwieldy inheritance framework function

I have a simple inheritance framework: ...
1
vote
2answers
518 views

User prompts for entering quiz questions

I have two methods here that does the same thing: get the user input and validate them. If they enter a letter, the program will prompt them again to enter a number. |After that, if it's a number it ...
8
votes
3answers
22k views

Validate IP address in Java

Following is the code that I'm currently using to validate the user given IP address (IPV4 and IPV6). It makes use of apache commons-validator's InetAddressValidator...
5
votes
2answers
265 views

Is this a good object oriented design for a file validator?

I'm working on a module that downloads a file saves it then validates if the file contents are valid. For simplicity lets assume that the file consists of 3 segments: Header, Body & Footer. Now ...
4
votes
1answer
819 views

Applying MVC to a validation application

I've been doing MVC for a few months now using the CodeIgniter framework in PHP but I still don't know if I'm really doing things right. What I currently do is: Model - this is where I put database ...
3
votes
1answer
428 views

Calling a Luhn check function when a credit card field changes

I feel like I should not be duplicating the code to gather the credit card number, but I am not sure how best to do it. Any suggestions? ...
2
votes
1answer
361 views

User data storage

I am writing my own website where users sign up. It then saves that data in an array. I want to know if this is effective or if there are better ways to do it. ...
1
vote
1answer
17k views

Form validation using AJAX with PHP fallback

I've used this PHP/AJAX method of validation for a bit, but I think it could use a little peer review. The basic idea was to create a way of verifying forms in a nice manor using AJAX, but also fall-...
11
votes
5answers
46k views

Checking whether a string is a valid number

I'm developing a Java Helper Library which has useful methods developers don't want to type out over and over. I'm trying to think of the best way of checking whether a string is a valid number. I've ...
16
votes
6answers
60k views

Is it better practice to have void method throw an exception or to have the method return a boolean?

This falls straight into the same category with the recent "Is it better practice to return if false or execute an if statement if true?" question. Often, while writing code, I find myself presented ...
1
vote
2answers
155 views

Validating required fields

I basically check for required input fields and if they fail to validate, I need to go to another level of output, check for other required fields, and so on... I can't get my head around this easy ...