Validation is used to check data to make sure it fits whatever required specifications are set for it.
5
votes
1answer
113 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 ...
4
votes
1answer
81 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 ...
6
votes
2answers
95 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
80 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 ...
20
votes
5answers
1k 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 weak, ...
7
votes
3answers
117 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 ...
1
vote
0answers
33 views
Spring Framework validation process design (documentation example) [closed]
I'm really surprised about Spring Framework bean validation process design. In my opinnion probably one of the worst codes I have seen in big project, and it is a major example of Spring validation ...
10
votes
5answers
749 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 reads in a text file, character by ...
3
votes
1answer
66 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 body Bar Code spec. after that. It ...
7
votes
2answers
69 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:
public static void main( String[] args )
{
String name = "hello, ddd";
boolean[] success = new boolean[ name.length() ];
...
7
votes
2answers
149 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 ...
6
votes
2answers
110 views
Am I implementing BDD correctly?
I'm writing a utility that validates fields on a web site. I decided I'd give Behaviour Driven Development (BDD) a try. The validator utilises rules to determine if a value the user provided is valid.
...
3
votes
1answer
46 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 ...
1
vote
3answers
176 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.
...
0
votes
1answer
73 views
Rails validating with condition block
Rails AR. validate one field, with 4 validators & 2 condition block
validates :inn,
presence: { if: -> { user.is_a?(Client) } },
inn: { if: -> { user.is_a?(Client) } },
...
1
vote
2answers
87 views
Making the code smaller and manageable
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:
$(document).ready(function(){
...
3
votes
2answers
116 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 ...
5
votes
6answers
177 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
290 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 done it this way for both Height ...
2
votes
3answers
101 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
1answer
145 views
Is this a good method for validating uploaded images?
I have attempted to write a method that checks that images being uploaded are valid.
public function checkValidImages(){
$errors = array();
$allowedImages = ...
1
vote
1answer
49 views
Is there a better way to write form validation?
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:
class event{
...
1
vote
0answers
76 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:
...
1
vote
0answers
164 views
Tiny MVC - Handling validation / sanitization in a model
I was told to post this here - original post.
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 ...
0
votes
0answers
91 views
Model Input Sanitation / Validation - Is this acceptable?
I'm fairly new to MVC concepts and PHP input validation.
I'm wanting to know if the following:
Follows the MVC pattern correctly - if not, how can I improve it?
Has any huge apparent security ...
0
votes
1answer
206 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
99 views
Different types of model validation
So we have a RESTful webservice that implements CRUD operations for a model, like this one:
class MyModel {
private long id;
private String name;
// other fields
private boolean ...
1
vote
1answer
140 views
Would like help on improving my 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
405 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 ...
1
vote
1answer
69 views
Is this a solid basic form validation script?
Is this a good form validation script? I'm using jQuery.
$(document).ready(function() {
$("form").submit(function() {
var shouldSubmit = true;
...
0
votes
1answer
89 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:
// Person model
function Person(firstName, age) {
// Check first name
if (firstName) {
...
0
votes
1answer
325 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 am not using an actual <form> ...
1
vote
2answers
167 views
Javascript form validation (zip code). Something better?
This is my first post. I have a javascript function that I intend use for validating zip codes and I wanted to know if my way could be made better.
function zipcode (inputtxt)
{
var zipcode ...
2
votes
1answer
3k 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 I seriously raises the question if it isn't slower.
jQuery code
$(document).ready(function () {
...
1
vote
1answer
90 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
<form class="atcLoginRequired" method="get" action="/somePage">
<input type="hidden" ...
2
votes
1answer
373 views
How to properly store error messages and display 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 ...
1
vote
0answers
105 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 ...
1
vote
1answer
351 views
HTTP URL validating
What do you think about this?
#utils.py
def is_http_url(s):
"""
Returns true if s is valid http url, else false
Arguments:
- `s`:
"""
if ...
5
votes
2answers
137 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 ...
15
votes
5answers
3k 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 ...