validation

Validating -moz-border-radius / -webkit-border-radius

Hi, is there any way to validate -moz-border-radius / -webkit-border-radius in the CSS validator? The client wants validation buttons in the sidebar (ugh!) and I can't find any way to bypass it. I've used @import too, no success. ...

Wondering why DisplayName attribute is ignored in LabelFor on an overridden property

Hi, today I got confused when doing a couple of <%=Html.LabelFor(m=>m.MyProperty)%> in ASP.NET MVC 2 and using the [DisplayName("Show this instead of MyProperty")] attribute from System.ComponentModel. As it turned out, when I put the attribute on an overridden property, LabelFor didn't seem to notice it. However, the [Required] attribu...

Recaptcha Validator in .NET 1.1 project

I am trying to use an old version of the Recaptcha Validator on a .net 1.1 project, which can be found here: http://recaptcha.googlecode.com/svn/trunk/recaptcha-plugins/dotnet-old/src/Recaptcha/ The code I have is very similar to an example that can be found at the above link: <asp:TextBox ID="EmailAddress" runat="server"></asp:TextBox...

Entity persist register validation listener

I'm using JBoss 6 with Seam, and I have an entity I am trying to persist, User. I have extended org.jboss.seam.framework.EntityHome to provide a UserHome class and have overridden the persist() method. I have thoroughly annotated my entity class with javax.validation annotations. When I provide valid values for all the fields in my entit...

IValidator.Validate method and adding error message to a custom type

I have several server controls that implement the IValidator interface. As such, they have their own Validate() methods that look like this. public void Validate() { this.IsValid = true; if (someConditionFails()) { ErrorMessage = "Condition failed!"; this.IsValid = false; } } I understand that these Validate() methods ...

Rails AR validates_uniqueness_of against polymorphic relationship

Is it posible to validate the uniqueness of a child model's attribute scoped against a polymorphic relationship? For example I have a model called field that belongs to fieldable: class Field < ActiveRecord::Base belongs_to :fieldable, :polymorphic => :true validates_uniqueness_of :name, :scope => :fieldable_id end I have several...

Rails validation "failing when succeeding"

I have this in my user.rb: attr_accessor :old_password def validate unless password.nil? errors.add_to_base("Old password entered incorrect") unless self.valid_password? old_password end end I have old_password as a a virtual attribute that has to be validated as matching with the current before updating to a ne...

ASP.NET MVC 2 Model encapsulated within ViewModel Validation

I am trying to get validation to work in ASP.NET MVC 2, but without much success. I have a complex class containing a large number of fields. (Don't ask - this is oneo f those real-world situations best practices can't touch) This would normally be my Model and is a LINQ-to-SQL generated class. Because this is generated code, I have c...

Using Unity Framework & Validation Application Block to Validate Method Parameters

Question Is it posible to have the Validation.Validate() method of the Validation Application Block see each parameter of the IParameterCollection supplied by Unity as my custom UserModel? Background: I am attempting to use both Unity and the Validation Application Block to validate method parameters. I would like to be able to d...

Given a user control with a form containing validation can I validate entirely server side?

We have an existing User Control that was built to dynamically generate a web form for an end user. This form includes required field validators, custom validators that use server side code and Regular Expression validatiors. We now have a need to use all these validators to verify that all the needed data is entered when using a separa...

validates_associated in production

Hi all. Imagine a simple model. class Service belongs_to :user validates_associated :user accepts_nested_attributes_for :user end Nothing special right? The validations on the associated User model trigger correctly in development mode. But don't do anything in production. I've added a validates_on_presence :user just like the d...

Is there a way to validates_presence_of only one time? (to skip that validation once the user's been notified)

So, I'd like for a user to see an error message if he submits a comment and the :name is blank (typical error message, don't need help with that). However, I'd then like to allow the user to skip that validation once he's been notified that "we like all comments to have a name." So, he submits the comment once, sees the notification, t...

Rails validation error messages: Displaying only message per field

Rails has an annoying "feature" which displays ALL validation error messages associated with a given field. So for example if I have 3 validates_XXXXX_of :email, and I leave the field blank I get 3 messages in the error list. This is non-sense. It is better to display one messages at a time. If I have 10 validation messages for a field d...

Data validation: fail fast, fail early vs. complete validation

Regarding data validation, I've heard that the options are to "fail fast, fail early" or "complete validation". The first approach fails on the very first validation error, whereas the second one builds up a list of failures and presents it. I'm wondering about this in the context of both server-side and client-side data validation. Whi...

ASP.NET MVC 2 validation using DTOs instead of domain entities

I'm struggling to mesh two best practices together: Using DataAnnotations + ModelBinding for validation in ASP.NET MVC 2 Using DTOs instead of domain entities when passing data via the ViewModel If I want to pass over DTOs instead of domain entities, then leveraging DataAnnotations + ModelBinding for validation would require me to sp...

Disable validation in an object in Ruby on Rails

I have an object which whether validation happens or not should depend on a boolean, or in another way, validation is optional. I haven't found a clean way to do it. What I'm currently doing is this (disclaimer: you cannot unsee, leave this page if you are too sensitive): def valid? if perform_validation super else super ...

PHP validating integers

Hi, I was wondering, what would be the best way to validate an integer. I'd like this to work with strings as well, so I could to something like (string)+00003 -> (int)3 (valid) (string)-027 -> (int)-27 (valid) (int)33 -> (int)33 (valid) (string)'33a' -> (FALSE) (invalid) That is what i've go so far: function parseInt($int){ /...

CM and Agile validation process of merging to the Trunk?

Hello All, We are a new Agile shop and we are encountering an issue that I hope others have seen. In our process, the Trunk is considered an integration branch; it does not have to be releasable, but it does have to be stable and functional for others to branch off of. We create Feature branches of the Trunk for new development. All wo...

Enterprise library Validation block and rulesets

I am using Rulesets on a type that looks like this: public class Salary { public decimal HourlyRate { get; set; } [ValidHours] //Custom validator public int NumHours { get; set; } [VerifyValidState(Ruleset="State")] //Custom validator with ruleset public string State { get; set; } } Due to business requirements, I'...

VB.NET Databound ComboBox need to force update in datasource when selection changes

I have a combobox where the SelectedValue on the combo is bound to a property on a business object. Everything works fine, but the property that's bound to the SelectedValue on the combo only gets updated when the focus leaves the control. I understand that the property doesn't get updated until the control is validated (loses focus), b...