validation

Approach for validating 1 of n fields must be valid?

What's the preferred approach for validating that at least one of fieldA, fieldB, or fieldC is valid using a Spring 3 validator? In other words, any 2 of the fields can be invalid, as long as the third is not. ...

Custom ModelBinder for IEnumerable post result in MVC

Consider this view model that uses two custom validators. It posts back to the controller in an enumerable collection. public class FormFieldViewModel { public Guid FormFieldKey { get; set; } public string Name { get; set; } // Utilize a string[] array since multiple-selection items will require this (we can assume array[0]...

Ruby on Rails. A custom message in a custom validator method

Hi. I want to have an ability to set a custom message in a model validator method to notify a user about incorrect input data. Firstly, I set a custom validator class where I redefine the validate_each method in that way as it recommended in rails' documentation: # app/models/user.rb # a custom validator class class IsNotReservedVa...

ASP MVC DateTime problem model validation problem

I have MS SQL in my local development server and production server. The DateTime format of my local server is "mm/dd/yyyy" but the format in production server is "dd/mm/yyyy". Every thing worked fine in my local server , but when I try to enter a date like "05/31/2010" in my production server, the Model Validation threw an error "The va...

How to validate a form just if user has submitted something (with Struts2)

Hello my friends, I'm developing a very simple Struts2 aplication, and I get this strange (and easy to resolve, I'm sure) problem: When I access directoly to login url, it shows login form (username and password text fields) with these errors: Name field is required Password is required The field are empty, because it's the first ti...

How to validate BPEL programmatically?

I want to validate BPEL programmatically. I use the openESB version of it but it would suffice having a validator for the standard BPEL or for other BPEL engines. Is there something out there that can do this? ...

Can you put a variable in a regexp?

I'm trying to validate wether a Model.category equals any existing Category name unless Category.exists?(:name => self.category.downcase) I had to put downcase in this to ensure all of them were downcased so they could match up as strings. But its a big server hit to update the attribute before_save, and I was thinking of just matchin...

Help regarding the XML schema validation in JavaScript

I am currently working on a scenario where I am converting an input flat file (.txt) to an output XML file using JavaScript. I might have a requirement to validate that output XML file against a 5000 lines XSD. So, could someone please help me with the advantages or disadvantages of doing a schema validation within a JavaScript functio...

Entity Framework - Validation (server + clientside, jquery) with data annotations, WITHOUT MVC?

Hi, there are several tutorials that explain how to use EF data annotation for forms validation using the MVC framework. And to use jquery for the client side. See e.g.: http://dotnetaddict.dotnetdevelopersjournal.com/clientvalidation_mvc2.htm I would like to achieve the same, but without using MVC/MVC2. I want to build a classic asp...

ASP.NET MVC : DataAnnotation validation execution order

I'm having some trouble understanding validation logic behing DataAnnotation validation : With the following model : [AlwaysInvalid] public class TestModel { [Required] public string Test { get; set; } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public class AlwaysInvalidAttribute : Valid...

a quick question about url validation

I don't really want to use curl or anything complex like that. I was looking for a simple way to check if the url (User will enter the url and it is then stored in my MySQL database) is valid and that it is a valid url i.e. the domain exists. Is fopen a good solution? Any tutorials or tips on this would be greatly appreciated. ...

How can I apply a @NotNull constraint to all fields in a class using javax.validation?

I'm using the hibernate implementation of the javax.validation and would like to know how whether anyone has been able to apply the @NotNull constraint annotation to all fields of a class, rather than to each individual field? I would prefer to enforce the @NotNull constraint as a default across my project, to avoid littering the code w...

WCF and Validation application block: Impossible to customize error messages?

When using WCF together with Enterprise Library 5.0's validation application block, is it possible to customize the error messages which are sent back to the client? I've added the ValidationBehaviour-attribute to my service contract and the FaultContract-attribute to the operation: <ServiceContract()> _ <ValidationBehavior()> _ Public...

Validate ValidationGroup

Hello. I have a button on which I wish to validate a specific ValidationGroup in ASP.NET. This button is not a server control, but a standard a tag with an onclick event on. I have multiple validation groups on this page, so by calling Page_ClientValidate() is not enough, as the other validators will kick in as well. If your answer r...

Validation propagating to related objects

I have a model like this: public class Person { public int ID { get; set; } [Required(ErrorMessage="Name cant be empty")] public string Name { get; set; } public Person Friend { get; set; } } I want to create a new Person, and made a form with the fields using the strongly typed HtmlHelper ID Name Frien...

How do i ensure that my textarea value should always contain the word "india" in javascript?

Hi friends, How do i ensure that my textarea value should always contain the word "india" in javascript? Actually i want to validate the textarea so that the user should always the word "india" in that. Please help me. Thanks in advance. ...

Is email@domain a valid email address

I'm evaluating a bunch of email validation techniques and someone of them output that email@domain is valid. I read somewhere that this email may be technically valid if it's being used for internal networking, but really for almost all practical purposes on the web today, this email should not evaluate to true. What does your email va...

good PHP validation libraries

I'm trying to find a list of good validation libraries (phone, email, etc.) that are constantly being maintained. I use PHP and am open to libraries from frameworks, but if you recommend a library from a framework, please say whether it allows you to use it without the framework itself? ...

How do I use JQuery Validation in ASP.NET MVC?

I'm trying to use the JQuery Validation's "addClassRules" method in my ASP.NET MVC application. In my master page I'm including the following files... <script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/MicrosoftMVCAjax.js") %>" type="text/javascrip...

How do you exit execution of a codeigniter program?

Hi everyone, I am currently working on adding pre-validation to my website. So that pages that require a log-in or other criteria, will only display if your session matches that criteria. I've got most of the system working, but I have one major obstacle. I cannot figure out how to stop CodeIgniter from running the rest of the controlle...