validation

What's the order of execution in property setters when using IDataErrorInfo?

Situation: Many times with WPF, we use INotifyPropertyChanged and IDataErrorInfo to enable binding and validation on our data objects. I've got a lot of properties that look like this: public SomeObject SomeData { get { return _SomeData; } set { _SomeData = value; OnPropertyChanged("SomeData"); } } Of course, I have an appropr...

Rails override validator message

Hi, I have a site thats served in 2 flavours, English and French. Here's some code app/views/user/register.html.erb ----------------- <% form_for .....> <%= f.text_field :first_name %> <% end %> app/models/user.rb ------------------ class User < ActiveRecord::Base validates_presence_of :first_name end Now to display ...

ASP.NET MVC 2 loading partial view using jQuery - no client side validation

I am using jQuery.load() to render a partial view. This part looks like this: $('#sizeAddHolder').load( '/MyController/MyAction', function () { ... }); The code for actions in my controller is the following: public ActionResult MyAction(byte id) { var model = new MyModel { ObjectPro...

C# mvc2 client side form validation with xval, prevent post

I'm using xval to use client side validation in my asp.net mvc2 web-application. Despite the errors it's giving when I enter text in a numeric field, it still tries to post the form to the database. The incorrect values are being replaced by 0 and saved to the database. But instead it shouldn't even be possible to try and submit the form...

Showing 'Please wait' message, not when there is an error in the validation

I have a form which is sent to an email address when user clicks Send. The form is validated first. I want to show 'Please wait' text to the user when he clicks the button. Now 'Please wait' text shows fine if the form fields are valid and the form is sent normally. But if there is an error in the form fields the 'Please wait' text still...

.NET 4 RTM MetadataType attribute ignored when using Validator

I am using VS 2010 RTM and trying to perform some basic validation on a simple type using MetadataTypeAttribute. When I put the validation attribute on the main class, everything works. However, when I put it on the metadata class, it seems to be ignored. I must be missing something trivial, but I've been stuck on this for a while now. ...

Date time validation in vb.net

Can anyone help me on how can I validate given DateTime between two DateTime using vb.net? the given DateTime must not in between the two DateTime.. ...

ModelState always valid

I've got something seemingly very simple not working. I have got a model public class Name: Entity { [StringLength(10), Required] public virtual string Title { get; set; } } public class Customer: Entity { public virtual Name Name { get; set; } } a view model public class CustomerViweModel { public Customer Customer...

Custom Model Validator for MVC

I am trying to write a customer validation with the goal of passing two values from the Event class to perform some validation logic and then add the error to the PURLValue property if it fails. I can't get it to work, am I using the the right approach, below, or is there a way to perform this at the class level and append the error to ...

DDD - Validation of unique constraint

In DDD you should never let your entities enter an invalid state. That being said, how do you handle the validation of a unique constraint? The creation of an entity is not a real problem. But let say you have an entity that must have a unique name and there is a thousand instances of this entity type - they are not in memory but stored...

How do I validate numbers in Javascript?

How to validate a numeric numbers? ...

How to check the value entered in EditText is aplhanumeric or not?

My application takes userid from user as input, the userid is alphanumeric i.e just the first character is (a-z), other part is numeric. How can I validate input of this type ( like G34555) ? ...

JQuery Validation using Remote posts empty data to webservice

I'm using the JQuery Validation plugin. I'm using the remote option to make a call to my webservice to check if a company name exists. The webservice only accepts JSON data. I pass the data to the webservice from the Company Input Field in my Form as follows: data: "{'company': '" + $('#Company').val() + "'}" But this always returns a...

WPF DataGrid row validation error count

Hi! I'm currently facing the problem, that I import an Excel file to a DataGrid. This works pretty fine, but after importing the table, I need to know how many rows are invalid. I have applied several validation rules for the different datatypes, and I have an icon in the row header, that shows up if the row is invalid. But since I ha...

Generating a error code per property in Hibernate Validator

I am looking at using Hibernate Validator for a requirement of mine. I want to validate a JavaBean where properties may have multiple validation checks. For example: class MyValidationBean { @NotNull @Length( min = 5, max = 10 ) private String myProperty; } But if this property fails validation I want a specific error code t...

DRY Validation with MVC2

Hi All, I'm trying to figure out how I can define validation rules for my domain objects in one single location within my application but have run in to a snag... Some background: My application has several parts: - Database - DAL - Business Logic Layer - SOAP API Layer - MVC website The MVC website accesses the database via the SOAP...

What is wrong with this javascript?

i use this javascript syntax for validating a checkbox... alert(document.getElementById("ctl00_ContentPlaceHolder1_Chkreg").checked); if (document.getElementById("ctl00_ContentPlaceHolder1_Chkreg").checked == false) { document.getElementById("ctl00_ContentPlaceHolder1_ErrorMsg").innerHTML = "please select the checkbox"; ...

How to dynamically set validation messages on properties with a class validation attribute

I'm writing Validation attribute that sits on the class but inspects the properties of the class. I want it to set a validation message on each of the properties it finds to be invalid. How do I do this? This is what I have got so far: [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class Li...

asp net mvc client validation with partial views and AJAX

Hello, I'm using client validation function of the MVC 2.0 framework (with Html.ValidationMessageFor() and Html.EnableClientValidation()) Everything is nice, when I use the validation in a simple form. But when I get this form via jQuery AJAX $.get('PathToMyForm', function(htmlResult) { $('selector').html(htmlResult); }); clien...

Java applet - Real-time textfield input verification

I'm trying to develop an input real-time verification on a textfield in a Java applet. The idea would be to have an input field that, if empty, once the user clicks in it it would show something like "0,00". Once the user starts to press the keys, only numbers should be accepted, and it would start to fill the text like this (imagine I...