validation

WPF Enterprise Library 5 Validation

I've just started to follow the EntLib hands on labs for the validation integration with WPF. http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8cd377-5522-4f45-a024-44a6ca5111ec&displaylang=en What I have found is that my textbox's databinding is firing fine when my validators pass. I have a string property with the follo...

WPF DataBinding: Nullable Int still gets a validation error?

I have a textbox databound to a nullable int through code. If I erase the data from the textbox it gives me a validation error (red border around it). Here is my binding code: ZipBinding = new Binding("Zip"); ZipBinding.Source = Address; zipTextBox.SetBinding(TextBox.TextProperty, ZipBinding); public Int32? Zip { get { ... } set { ......

Is there any way to get IsDate(Date) to come back as false?

I'm reviewing some code in VB.net, and in a validation object they have written the following If Not IsDate(Entity.SelectedDate) Then ErrorList.Add(New CValidationError("MainReport", "Please select a weekend date")) SelectedDate is of type Date. It seems to me it would be impossible to ever hit this condition. Is this tru...

Block Level Elements in <a> Tag, Validation vs Usability

I have often wrapped block level elements with <a> tags in order to make the whole group clickable. For example, say I have a list of events: <ul> <li> <a href="#" style="display: block;"> <div style="float: left; display: inline;">12/12/2010</div> <div style="float: left; display: inline;">Some event...

how do I convert a string to a valid variable name in python ?

Python n00b here I need to convert an arbitrary string to a string that is a valid variable name in python. Here's a very basic example: s1 = 'name/with/slashes' s2 = 'name ' def clean(s): s = s.replace('/','') s = s.strip() return s print clean(s1)+'_'#the _ is there so I can see the end of the string That is a very n...

has_many :through, forms and validation

I have two quite nasty problems with join model. I think I am just going wrong way, so maybe someone can clear up my approch a bit. First there are some models with realtions like this: class Account < ActiveRecord::Base has_many :tickets, :through => :assigment has_many :assigments ... end accepts_nested_attributes_for :assigmen...

Can anyone suggest a resource that lists suggested maxlengths for common fields like city, email, phone, etc?

I know email addresses are limited to 254 characters, but is there a single resource that outlines suggested maxlengths for common fields like contact information e.g. phone, city, etc? It seems every project I work people just shoot from the hip on their proposed limits. I'm hoping to find a canonical reference, targeted to a specific ...

JQuery LiveValidation and Thickbox Variable Error

I am working in Symfony 1.0 launching a Thickbox modal window that contains a form, which is being validated on the fly using LiveValidation. The modal window launches fine, however the LiveValidation plugin is getting an error, saying that "ReferenceError: Can't find variable: LiveValidation" and then referencing various variables I am ...

Why doesn't the Validation.Error event get fired in this case?

I have copied an example from MSDN and added the Validation.Error event. Problem is, it never gets fired. Why not? <UserControl x:Class="MeasurementControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxm...

MVC DataAnnotations - Require at least one field in a group to be filled

Hi, How can I use DataAnnotations to validate that at least one of these fields are filled in? public string Name { get; set; } public string State { get; set;} public string Zip { get; set;} ...

rspec association test only works in one direction

I upgraded to Rails 3 and RSpec 2 and one of my RSpec tests stopped working: # Job.rb class Job < ActiveRecord::Base has_one :location belongs_to :company validates_associated :location end # Location.rb class Location < ActiveRecord::Base belongs_to :job end # job_spec.rb describe Job, "location" do it "should have a ...

Anyone got a Date of Birth Validation Attribute for C# MVC?

Someone must have written this before :-) I need a validation attribute for date of birth that checks if the date is within a specific range - i.e. the user hasn't inputted a date that hasn't yet happened or is 150 years in the past. Thanks for any pointers! ...

How to customize the "The value 'foo' is not valid for Number." error message?

[MetadataType(typeof(PersonMetaData))] public partial class Person { public class PersonMetaData { [Required(ErrorMessage="The number is required")] public object Number {get;set;} } } This error message is shown when the number field is empty and when there's an invalid input it gives "The value 'foo' is not va...

Client side validation of list in ASP.Net MVC 2

Hi all, I've used stackoverflow many a time to solve my problems (code related!) but this is the first time I've needed to post a question cause I cannot work out whats wrong. When I enable client side validation on a view that allows editing of a collection of objects which use DataAnnotations for validation the following exception is...

ASP MVC 2 Validation : Passing Javascript code to the client

I am writing a custom validation attribute It does conditional validation between two fields When I create my rule, one of the things that I could not solve is how to pass javascript code through ValidationParameters Usually, I just do ValidationParameters["Param1"] = "{ required :function(element) { return $("#age").val() < 13;) }" Ho...

Edit Validation.ErrorTemplate in code

I have a UserControl that contains a TextBox. The TextBox.Text property is data-bound and validated. When a Validation.Error occurs, I would like to edit the Validation.ErrorTemplate. Specifically, I would like adorn it with a Polyline. The end goal is to have a UserControl that has a red squiggly line under the text when it fails a va...

Validating Form

How to validate form fields on submit button using jquery? ...

How do I validate the page title length in sharepoint 2010?

To aid navigation we would prefer our users to only create pages that have a title of less than or equal to 30 characters. Is there a relatively easy way that this can be accomplished? I've seen a javascript solution that uses a method called PreSaveAction but it's not really what I'm looking for as it has got to work site wide (whethe...

How do I validate a property from a different class with DataAnnotations

I have a competition class and a competitionEntry class. A competition can have 5 questions (just string values) and the competitionEntry can have 5 answers (also only string values). How would I validate that if a question is present that the answer should be present as well? I think I need a custom validation attribute but how would...

Range Validation with Excel using C#

Hi, I've been looking on the internet for 4 hours and I just can't do it. My objectives : create a combo where I can sort my items and when I click on one of them, the item appears alone. In Excel, easy to do, but I can't do it in C#. I found this answer : Other topic, but I can't understand where the "this.Controls" comes from. Tha...