validation

ObjectValidator problem

Hello, I'm having problems with [ObjectValidator]. So, i have: public class UserBO { public int ID { get; set; } [NotNullValidator(MessageTemplate = "Can't be null!")] [RegexValidator(@"[a-z]|[A-Z]|[0-9]*", MessageTemplate = "Must be valid!", Ruleset = "validate_username")] [StringLengthValidato...

Custom model validation of dependent properties using Data Annotations

Since now I've used the excellent FluentValidation library to validate my model classes. In web applications I use it in conjunction with the jquery.validate plugin to perform client side validation as well. One drawback is that much of the validation logic is repeated on the client side and is no longer centralized at a single place. ...

Validation after Postback

I have a form that inserts a record into database. The form has two required fields with RequiredFieldvalidators assigned to them and an insert button. After Insert button is clicked, entry is added to DB and textboxes are cleared. But when the page is reloaded after postback, validation kicks in. Is there a way to set page as valid afte...

Why is all my content disappearing when I turn on client validation in ASP.NET MVC 2 RC2?

I am using the following partial to render the editor for the Create and Edit pages: PersonEditor.ascx <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProj.ViewModels.PersonEditorViewModel>" %> <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript" /> <script src="../../Scripts/MicrosoftMvcValidation....

Bug? Client-side validation in ASP.NET MVC 2 causes ValidationSummary message to show even if there is no error

With client-side validation turned on in ASP.NET MVC 2 RC2, the validation summary message is visible even when I first load my Edit.aspx page. It does not show in bold red, however, just plain text. If I submit the form with an error, then the validation summary message turns bold red, and a list of errors appears below. Here is the co...

Remove JQuery validationEngine from form

I am using Position Absolute's jQuery validationEngine but I need to remove it after attaching it to a form. I have 2 submit buttons on my form - one for save and one for save as draft. I attach the validationEngine to the form when Save is clicked. If the validation fails, and the user clicks Save as Draft (by passing the validatio...

Perl Regular Expressions to match a MD5 Hash?

Recently programming in PHP, I thought I had a working Perl regular expression but when I checked it against what I wanted, it didn't work. What is the right expression to check if something is a MD5 has (32 digit hexadecimal of a-z and 0-9). Currently, I have /^[a-z0-9]{32}$/i ...

Validate MVC 2 form using Data annotations and Linq-to-SQL, before the model binder kicks in (with DateTime)

I'm using linq to SQL and MVC2 with data annotations and I'm having some problems on validation of some types. For example: [DisplayName("Geplande sessies")] [PositiefGeheelGetal(ErrorMessage = "Ongeldige ingave. Positief geheel getal verwacht")] public string Proj_GeplandeSessies { get; set; } This is an integer, and I'm validating ...

xVal Causing NUnit to Crash when checking ModelState.IsValid

I am trying to run a simple test on a controller in MVC. This controller validates the input using xVal and DataAnnotations. When I run the test (using NUnit via Resharper, NUnit standalone or TestDriven.Net) it crashes the runner with no decent error message. In the event logs it just has a fairly generic .NET Runtime 2.0 Error Repor...

How do I prevent form submission until multiple ajax calls have finished? jquery

Following on from a previous question where I asked about disabling a submit button until all ajax calls have finished returning... It seems that people are still managing to submit the form even with the button disabled and a warning sign. I guess it could be from pressing 'enter' in a text input. How do I go about disabling the whole...

Problem with postbacks and validators

I'm using the built-in ASP validators on a few form elements. They work fine - if I click the submit button (a Button), validation occurs without postback and errors are displayed in a ValidationSummary. When that occurs, I also want to call a method in codebehind which changes the CSS of elements, switching their background color to red...

Enterprise Library Configuration and .NET 4.0

I have a class library created in .NET 4.0 When I use the Enterprise Library Configuration tool to load this assembly, I get: Error loading assembly: Could not load file or assembly. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. I have tried the Configuraiton tool in both the Enterpri...

Help with HTML validation error: Table column has no cells beginning in it.

Please help me with this validation error. I can't understand what it means or what's not standards complaint with my HTML. I'll repost it here since hopefully I'll fix it and that link will no longer work: Table column 2 established by element td has no cells beginning in it. …="tooltip_table"><tr><td colspan="2">20 yd range</td></tr...

mootools formcheck : regex for number validation

Hello, i need to validate currency field with formcheck plugin for mootools. It has number validation type, and number accepts regex to personalize validation. I need sample to validate: 1.000,01 --> ok 1,000.02 --> not ok 1000,12 --> ok 1000.13 --> not ok 10.000 --> ok 100.00 --> not ok and so on. Can you help me p...

How can I keep a value in a text input after a submit occurs?

Hi there! I want to validate a form to make sure a user writes in a name and last name. If a user writes in only his last name, the form should show again with an error message beside the last name field, but the name value should still be there. I don't know how to do this, hehe. I'm just a newbie PHP programmer. Here's what I have ...

Two columns must not equal each other in Rails

I'm creating a social network in Rails and I have a model like this: create_table "friendships", :force => true do |t| t.integer "user1_id" t.integer "user2_id" t.boolean "hasaccepted" t.datetime "created_at" t.datetime "updated_at" end The problem is that you cannot add yourself as friend, so I tried this in my...

WPF Seperate Error and Warning Styles

How can we show user Warnings in a similar way to Errors. The only difference is that the control e.g. TextBox needs to have a different error template and similar to Validation.HasError there needs to be a Validation.HasWarning. In other words not all validation issues are "errors" (in our application at least). We want to visually ind...

How to write an XML Schema for which this XML document is a valid instance?

<Unit Number="1"> <Identifier Type="ABC" Text="STO0001"/> <Identifier Type="DEF" Text="Some Value"/> <Identifier Type="GHI" Text="20070805"/> <Disposition Unit="Accept"/> </Unit> I need to validate that Type="DEF" Text="Some Value" is not empty Something Like: <xs:complexType name="requiredValue" abstract="true"/> <xs:complexTy...

How can I prevent my form being sent if a user writes misformated entries in my fields? ie. Letters in number fields.

What happens: When I write two values in both text boxes, the page doesn't show the Congratulations message as it should. When I write only 1 value, the correct thing happens, which is not show the congratulations message. What should happen: If a user writes only 1 value, the form should still appear with any previously filled...

How to validate in Java a XML with XSD schema

How to validate a XML in Java, given a XSD Schema? ...