validation

jquery custom method question,

I added a captcha to my form and I want to validate this field. jQuery.validator.addMethod("matchCaptcha", function(value,element) { return this.optional(element) || value == '#request.strCaptcha#'; }); #request.strCaptcha# this part simply returns an alphanumeric char something like 'cZk9ljW' under the rules, i added: captch...

PHP: Detect invalid characters in a text

Hello! I would like to parse user inputs with PHP. I need a function which tells me if there are invalid characters in the text or not. My draft looks as follows: <?php function contains_invalid_characters($text) { for ($i = 0; $i < 3; $i++) { $text = html_entity_decode($text); // decode html entities } // loop is used ...

What is the purpose of suffixes .RequiredError, .FormatError, etc.

Reading the Oxite source code, I have found that validators save bad property name with some suffixes (RequiredError, MaxLengthExceededError, InvalidError, FormatError) validationState.Errors.Add(CreateValidationError(user.Name, "Name.RequiredError", "Name is not set")); validationState.Errors.Add(CreateValidationError(user.Name, "Name...

Zend_Validate_Between strange error message

I am experimenting with the Zend_Validate_Between class. I set it up thusly: $scoreBetweenValidator = new Zend_Validate_Between(-3, 3, true); so the validator should only accept values between -3 and 3, inclusive. On an invalid value I got a '%value%' was not found in the haystack error message, which I think belongs to the Zend_Val...

Is machine readability a valid point for xhtml if it does not validate?

I often run across developers that insist on using the XHTML doctype and when I ask why they common response is that its "machine readable". Once the project is underway the markup does not validate. Now that their markup does not validate...is machine readability valid anymore? I assume that if it does not validate it can't be process...

Entering data into a grid

A UI question: is there some consensus on the best (defined as "the one which end-users like best") or least-bad way to implement data entry into a grid? I have a grid, with many rows. The grid's columns contain various types of properties, which the user can enter/edit. The "types" of properties include: Free text Numbers (numeric di...

Problem adding validation list in excel sheet using VBA

I have an excel sheet that is loaded with a dynamic result set of data. I need to add a YES/NO dropdown at the end of each row once all the data is loaded. I have to do this dynamically as I do not know the size of the result set beforehand. The following code throws an 'Applicaton-defined or object-defined error': Dim firstRow As Integ...

Email regular expression

Possible Duplicate: What is the best regular expression for validating email addresses? I know this is a common question, but I still can't seem to find a great regular expression to use when validating email addresses. I don't really have time to go read the spec and write my own. What have ya'll used before, and has it worked...

Is the "id" in an input tag necessary?

<p> <input type="text" id="search" name="keywords" /> <input type="submit" value="Search" name="Submit" /> </p> For the above code I was getting validation errors, but once I removed the id="search" the validation was good and error-free. I thought you needed an id, but I'm wondering if it is supposed to be there? ...

Javascript String Validation

i have a string... i want to validate that string so that it should not contain certain characters like '/' '\' '&' ';' etc... how can i do that all at once??? ...

Setting the ControlToValidate on a Validator

I am currently re-writing a dynamic form based on database information. This form contains numerous 'Item Specific' properties, each of which has a single control and label, for example Category has a label that says "Category" and a DropDownList that contains all the options. The problem I now find is that each of these is added to th...

how to assign validators to a button

Hi, Is there any way to assign a group of asp.net validations to validate when a button is clicked? I've got two sections in my site. If one section isn't submitted and the user decides to submit the other, I want to prevent the validation from the first section from firing also. Any suggestions or pointers? Thanks ...

Get validations of a Rails model

Given a model that has validations in the model_name.rb file, how can I access those validations manually? I'd like to cook up my own form validation system that would work alongside the built-in Rails tricks and I want to keep everything as DRY as possible. My main problem is that I need to make server-side validations before any of the...

Validating nested models?

To be more specific, "How do I validate that a model requires at least x valid associated models to be created?". I've been trying to validate nested models that get created in the same form as the parent (and ultimately show immediate validations a la jQuery). As a popular example, lets assume the following models and schema. class Pro...

Why is my XML validation failing against its schema?

Howdy, I need to validate a XML file against a schema. The XML file is being generated in code and before I save it I need to validate it to be correct. I have stripped the problem down to its barest elements but am having an issue. XML: <?xml version="1.0" encoding="utf-16"?> <MRIDSupportingData xmlns="urn:GenericLabData"> ...

NHibernate Validator with optional fields and optional rules?

If I have a class that holds phone numbers, called PhoneNumbers and I have a MVC view with two text entry boxes, each mapped to a PhoneNumber and I want one to be optional and one to be required, how can I achieve this with NHibernate Validator? Right now my PhoneNumber class looks like this: public class PhoneNumber { [Pattern(@"^\d{...

What's the proper place for input data validation?

(Note: these two questions are similar, but more specific to ASP.Net) Consider a typical web app with a rich client (it's Flex in my case), where you have a form, an underlying client logic that maps the form's input to a data model, some way of remoting these objects to a server logic, which usually puts it in a database. Where should...

Validating UPDATE and INSERT statements against an entire table

I'm looking for the best way to go about adding a constraint to a table that is effectively a unique index on the relationship between the record and the rest of the records in that table. Imagine the following table describing the patrols of various guards (from the previous watchman scenario) PK PatrolID Integer FK GuardID Integer...

Client and Server side validation in asp.net MVC application

Hello, We are starting a new ASP.NET 3.5 MVC application. Following are the requirements for validation: Both client and server side validation. Validation rules in one place. Common scenarios like 'Password' & 'Confirm Password' are addressed. Options: DataAnnotation (ONLY does server side validation) EL 4.1 Validation Applicatio...

finding json errors with ruby

i am using ruby gems json_pure and when i get parsing errors i am not able to determine the line number where the error is occuring. i was expecting to find a validator written in ruby that would tell me the line number. what is the best ruby approach to finding the json errors quickly? thanks! ...