validation

JSR-303 custom ConstraintValidator in Spring MVC

Hi! I am trying to implement a @Future validator for joda time objects. I followed the implementation for the @Past annotation found here. So far, so good. Now I am failing at telling spring that I have this new constraint. Is there a way to configure the Spring MVC (other than just <mvc:annotation-driven />) to tell him where the vali...

django clean_field that references other fields

Hi all, I have a situation where a user can click a check box field, "field_enable", on an html form and a nice jQuery operation will display another field, "fielda", for the user to enter more data in. When "field_enable" is checked, I want to require the user to also fill out "fielda". When "field_enable" is unchecked, the user shoul...

Processing only visible form fields for validation

I need to validate a bunch of form fields within one element. I just need them all to be 'required', not necessarily input checked (email, phone number, etc). The problem is, I have the form dynamically showing and hiding inputs and select elements, and I need the validator to ignore hidden ones. I have looked into this a fair amount -...

Validation in ASP.NET MVC using Code Contracts

I want to know the available options for using the "Code Contracts" attributes as the validations rules in ASP.NET MVC 2. ...

jQuery attr() not working inside jQuery Validation plugin?! Returns undefined!

So I am using attr("alt") inside the "success" block in jQuery Validation plugin. However, attr("alt") returns undefined even though the attribute ("alt") is definitely defined. Here's my code: $(this).validate({ success: function(label) { var api = $('#' + label.attr("for")).qtip("api"); api.updateContent($('#' + ...

Checking if a string holds an integer

Do you know of a function that can check if a string holds an integer? Here's how I'd expect it to work: holds_int("23") // should return true. holds_int("2.3") // should return false. holds_int("qwe") // should return false. ...

I'm having problems with validating a page. Please help

Hi all, I'm having problems validating my page to strict 1. Can anyone help me? It keeps on showing: Line 48, Column 4: document type does not allow element "h2" here; assuming missing "li" start-tag <h2>Current job vacancies</h2> Line 60, Column 6: end tag for "li" omitted, but OMITTAG NO was specified </div> You may...

What elements can be contained within a <a> tag?

My google fu is not up to scratch this evening. What are the valid html elements, if any, that can be contained within a <a> tag? <a> ?? </a> ...

xml validation: validating a URI type

I'm using python's lxml to validate xmls against a schema. I have a schema with an element: <xs:element name="link-url" type="xs:anyURL"/> and I test, for example, this (part of an) xml: <a link-url="server/path"/> I would like this test to FAIL because the link-url doesn't start with http://. I tried switching anyURI to anyURL but...

MVC validation of Date using DataAnnotations

This is my Model class public class Model { [DataType(DataType.DateTime, ErrorMessage = "My error message")] public DateTime Day { get; set; } } When I try to input incorrect value for example "notdate" i got the error "The value 'notdate' is not valid for Day." instead of my specified ErrorMessage "My error message". I use A...

ASP.NET validators

hi, i am using asp.net validators for validating simple fields like blank textboxes (e.g. login page). my problem is when i am submitting blank fields,the validators are giving correct output. and in second step, when i entered incorrect username the label where i have given error message of username is getting displayed along with blank...

Rails' validates_confirmation_of

I am trying to create a registration form (just for practice) and saw this method for rails and want to use it. However, I am quite confused on how I should use this. I have fields where each corresponds to an attribute in the database. Like I have text_field_tag(:username) and my model has t.string :username. For password confirmation,...

WPF Data Validation from a property setter function

Hi There, I have a class that is bound to GUI elements as follows: <TextBox Style="{StaticResource ValidatedTextBox}" Text="{Binding MaxDistance, ValidatesOnExceptions=True}" > <TextBox.Style> <Style TargetType="TextBox" > <Style.Triggers> <Trigger Property="Validation.HasError" Value="True"> <Setter Pr...

How to validate data for a Rest Service with symfony

For example imagine I've a rest service, this service takes two parameters : phone number text The goal is to send the message via a sms gateway. I've a class Message which has two properties destinationNumber and textMessage. Before calling the gateway, I want to validate the data received by the rest service. I've two questions r...

People Picker AllowEmpty Property

Hello All, I am using the people picker user control of SharePoint in my aspx page. I have set the AllowEmpty property of people picker control as false. But, still the required field validation is not occurring for the control. I don't want to use a required field validation control explicitly for validating this. Any insights? Rega...

WCF RIA +SL4 - how to validate a collection?

Hello! I'm using WCF RIA + Silverlight 4.0 in my project. On client and server side I need to check (via validation process) if collection (e.g. Orders) that belongs to e.g. Manager is filled or not. The rule is that at least one Order should be there otherwise validation failed. Orders are loaded together with Manager via [Include] a...

How do I specify error member key in ASP.NET MVC CustomValidation?

I'm trying to add CustomValidation and make it return error for Html.ValidationMessageFor(m => m.SubleaseCompany) [CustomValidation(typeof(CreateSpaceModelValidation), "ValidateCreateSpaceModel")] public class CreateSpaceModel { public Building Building { get; set; } public Space Space { get; set; } public string Sublease...

wcf and Validation Application Block unit testing

I'm trying to test validation that I've setup for my wcf service. What's the best way to do it? [ServiceContract] [ValidationBehavior] public interface IXmlSchemaService { [OperationContract(Action = "SubmitSchema")] [return: MessageParameter(Name = "SubmitSchemaReturn")] [FaultContract(typeof(ValidationFault))] JobData...

Ignore default text in jquery validation plugin

Hi, I am using the jquery validation plugin (bassistance.de/jquery-plugins/jquery-plugin-validation/id) for a bit of client-side form validation. The plugin is working great but I cannot figure out how to force it to ignore some default text within a textarea. <form action="#" id="landingForm"> <p> <textarea id="askTexarea" class="requ...

Throw (or correspondingly) on NULL function argument versus letting it all blow up?

In previous large-scale applications requiring high robustness and long up-times, I've always been for validating a pointer function argument when it was documented as "must never be NULL". I'd then throw an std::invalid_argument exception, or similar, if the argument actually was NULL in C++ and return an error code in C. However, I'm ...