validation

Rules Validation on Data or Domain layer?

Hello, I've been reading Pro ASP.NET MVC Framework, Steven Sanderson, and in chapter 11 it discusses data validation. On page 390 we see the section Moving Validation Logic into Your Model Layer. In this section we see, in page 392, some code showing how to implement validation. The code implements a GetRuleViolations() method and the ...

Number validation in required field validator

Is it possible to put Number validation in required field validator in asp.net text box? ...

How do I validate a textbox to only contain numbers?

If the user enters non-numeric and numeric values in a textbox, how do I keep only the numeric part? ...

Asp.NET MVC Custom Validator For a View Model?

I am using custom view model classes as DTO objects to hold data for display on my View pages. I have applied validation via the DataAnnotations library to perform server side validation on the properties of these classes. Here is a simple example: [DisplayName("Customer Account Id")] [Required(ErrorMessage = "* Account Number is requir...

XSD Schema Validation in Ruby

I have found several sources regarding how to validate an xml document against a schema, but I have an application in ruby in which I need to validate that a user supplied schema is a valid schema itself. Is there a way to that I can check this? Is there an XSD schema to validate an XSD schema? Or are there libraries or gems that do t...

Data validation does not enforce model validation?

I followed these tutorials: http://www.asp.net/learn/mvc/tutorial-39-cs.aspx http://schotime.net/blog/index.php/2009/03/31/integrating-xval-validation-with-linq-to-sql/ in order to enforce data validation using Data Annotation for a LINQ-To-SQL-generated class. The metadata class looks like this: [MetadataType(typeof(PositionValidatio...

WPF - Binding ValidationRules to Combobox.Text property

Hi, I'm using a WPF combobox whose IsEditable value is set to true. Basically, I have a list of times displayed int he comobo box. User can himself type in a time if he does not find a suitable time in the combobox. I have attached a ValidationRule to my ComboBox.SelectedItem so that whenever the user selects a time my ValidationCla...

Databound DateTimePicker fires validation error

I have a databound DateTimePicker: dateDateTimePicker.DataBindings.Add(new Binding("Value", paymentBindingSource, "Date", true); paymentBindingSource.DataSource = payment; payment is Entity Framework object. payment.Date contains valid DateTime. When form is shown, dateDateTimePicker contains correct value, but an ErrorProvider is sho...

ActiveRecord Validations: Display something other than the column name

I assume this is really easy, and I'm missing something obvious. I'm connecting to a legacy database that has column dblOrderQty. I'm validating it thusly: validates_numericality_of :dblOrderQty, :greater_than => 0 This, of course, presents "Dblorderqty must be greater than 0". I'd much rather have that say "Quantity must be greate...

Accessing the value of a Richfaces calendar during validation.

I am trying to validate a field based on another field's value. <h:form id="item"> <s:validateAll/> <h:selectBooleanCheckbox id="selected" value="#{bean.selected}" validator="selectedValidator"/> <rich:calendar id="startDate" value="#{bean.startDate}"/> </h:form> However, inside my validator. public void validate(FacesContext c...

Remove any spaces while typing into a textbox on a web page

How could I, on the fly, remove spaces entered into a textbox while the person is typing? ...

Is there a way to do XSD validation of an XML stream in PHP

Let's say I want to be able to validate that a 50GB+ XML file conforms to a given XSD. I could use DOMDocument::load & DOMDocument::schemaValidate but that will take all of time on loading and will generally exhaust all available memory for me. Is there any way to feed an XSD to a SAX or any other type of stream processor and have it...

Use Zend Framework components without the actual framework?

I was wondering if anyone knew how to use some components of the Zend Framework without having to actually use the framework. For example, I would like to use their Zend_Validate components, but don't want the overhead of the framework as it's a small one-page script. Can this be easily done, and if so, are there guides/tutorials on ho...

How to do Silverlight Validation in a web service

I am currently trying to implement the built-in Silverlight 3 validation against objects that are accessed via a web service. I have tried to follow the examples listed on SilverLight.net (Jesse Liberty's tutorial) and have had no luck. In fact, I could not get the tutorial to work after I downloaded it unless I started it without debu...

CakePHP validation for dates

In CakePHP, is there a built-in way of validating a date to be within a certain range? For example, check that a certain date is in the future? If the only option is to write my own custom validation function, since it'll be pretty generic and useful to all my controllers, which is the best file to put it in? ...

[nhibernate validator] how to validate custom properties?

I played around with nhibernate validator and got a nearly perfect solution. I can define a property to be validated and it's done on pre-save. But I have some cases where it's not working. Let's assume I have an object called person and via nhibernate I mapped the address(also an object) to be a property of person (in fact it's a lis...

MVC DataAnnotations Testing

I have the following code in a partial class and I'm using LINQ to SQL: [Bind(Include = "OrderId,OrderTypeId,CustomerName,Price")] [MetadataType(typeof(OrderMetadata))] public partial class Order { } public class OrderMetadata { [DisplayName("Customer Name")] [Required] public object CustomerName { get; set; } } I'm tr...

jquery validate and asp.net - clear rules?

hey folks, I'm using the fantastic jquery .validate plugin from Jörn Zaefferer at bassistance I'm using asp.net, so have one long form, though the form is broken up into 3 sections via a jquery accordion with buttons to switch between accordion panes. I want the button in pane one to validate pane one fields, same with pane two, etc...

XML validation for an element with multiple types?

I have an element that can have multiple types (not my design). The element itself is a complex type with a sequence of sub-elements and the XML is generated from the serialization of a property, and that property returns a type of base class. So when the XML is generated the type ends up getting set in the XML to whatever the object rea...

XML element with "xsi:type" attribute does not validate. It expects a "type" attribute

I have XML that includes an element that has the attribute: xsi:type="AnswerBool". My xsd has that element and has set up an attribute with the name="type" and then restricts the enumeration values to "AnswerBool" (and others). However, when I try to validate the XML it fails. If I change the XML so that the element uses type rather than...