validation

JSON schema validation using java

I'm writing some acceptance tests for a java webapp that returns JSON objects. I would like to verify that the JSON returned validates against a schema. Can anyone suggest any tools for this? ...

ASP.NET MVC 2 validation LINQ to SQL

Currently I have a DataModel object which contains my linq to sql classes(a dmbl file). Currently I use a partial class to validate the incoming input. For example public partial class User : IEntity { public NameValueCollection CheckModel() { return GetRuleViolations(); } /// <summary> /// Method validates...

How can I test if an input field contains foreign characters?

I have an input field in a form. Upon pushing submit, I want to validate to make sure the user entered non-latin characters only, so any foreign language characters, like Chinese among many others. Or at the very least test to make sure it does not contain any latin characters. Could I use a regular expression for this? What would be th...

Zend Form: add error message after form validation

How to add an error message to Zend Form element after the form was already validated? I'm trying to add error mesages I get from Zend_Auth (now I'm displaying them using flashMessenger). I tried something like this: $form->getElement('username')->addErrorMessage('my message'); ...

Asp.Net MVC EnableClientValidation doesnt work.

I want as well as Client Side Validation as Server Side Validation. I realized this as the following: Model: ( The model has a DataModel(dbml) which contains the Test class ) namespace MyProject.TestProject { [MetadataType(typeof(TestMetaData))] public partial class Test { } public class TestMetaData { ...

asp:CustomValidator / OnServerValidate

I have a CheckBoxList that I am trying to validate that at least one of the checkboxes is checked. Markup: <asp:CustomValidator ID="RequiredFieldValidator8" ValidationGroup="EditArticle" runat="server" ErrorMessage="At least one Category is required." OnServerValidate="topic_ServerValidate" /> <asp:CheckBoxList id="checkboxlis...

CSS issue when using ASP.NET Validation Control

I'm using an ASP.NET Validation control and when there is an error, for some reason, some CSS are ignored. Using Firebug or IE Developer Tools I would have to reapply the styles in order to get it to where it was. Any ideas why this glitch happens? Cheers ...

Passing Validation exceptions via WCF REST

I am using WCF and REST, and I have complex types, which are working fine. Now I need to check for validation, I am thinking of using DataAnnotations e.g. public class Customer { [Required] public string FirstName {get;set;} } Now where the issue is how do I pass this validation down to the REST service? ALso I need to validat...

ASP.Net MVC2 Client and Server Validation sharing the same code - is it possible?

With the excellent XVal by Steve Sanderson, it is possible to tell the client side validation to post the value being validated to the server using jquery. A method on the server then uses the same server side code you use for your server side validation, and returns simply a true or false to determine if the field is valid. The advanta...

Conditional Required Attribute for validation

We're trying to get a conditional attribute to work, case in point, there's a boolean (checkbox) that if checked, its related text is required. So, ideally we'd have something like ... public bool Provision { get; set; } [ConditionalRequirement(IsNeededWhenTrue = Provision)] public string ProvisionText { get; set; } Is this even poss...

jQuery + Validation plugin: add/remove class to/from element's error container

Hi guys, I'm working with the jQuery Validation plugin and I wrote the following code which adds a class to the element's (<input>) parent (<label>) if not valid, as well as inserting the actual error element (<span>) before the <br>. the HTML ... <label> text<br><input> </label> ... and the jQuery. $("#form_to_validate").valid...

Lists inside lists don't validate with w3c?

Hi everybody, I've got some lists inside lists to make some fancy drop-down menus. e.g <ul> <li>something <ul> <li>sub menu</li> </ul> </li> </ul> Problem is, w3c doesn't like it. Is there a way to make this validate or this just one of these hacks that browsers can render, but w3c dislikes? ...

JQuery email validation?

I'm new to Jquery and was wondering how to write an email validation using JQuery? ...

RegularExpressionValidator - Windows ID Validation

I'd like to setup a RegularExpressionValidator to ensure users are entering valid windows IDs in a textbox. Specifically, I'd like to ensure it's any three capital letters (for our range of domains), followed by a backslash, followed by any number of letters and numbers. Does anyone know where I can find some examples of this type of v...

What is the most elegant way to validate the presence of ONLY one out of two attributes using Rails?

class Followup < ActiveRecord::Base belongs_to :post belongs_to :comment end This model needs to only have either a post or a comment, but only one of the two. Here's the rspec for what I'm trying to do: it "should be impossible to have both a comment and a post" do followup = Followup.make followup.comment = Comment.m...

asp.net rangevalidator for calendar extender entries gives problems in safari

Hi there, I have the following scenario: arrival and departure dates have to be selected on a form, through 2 textboxes with a calendar extender each. I validate the entries to check that no date before today is selected and to check that the departure is after the arrival. I used a rangevalidator and a comparevalidator. In IE, Firef...

How to validate against Multiple validation groups?

I have two validation groups: parent and child I have an add button that needs to only validate the child validation group which is easily done. The save button needs to validate against the parent and child validation groups, both client side and server side. I think I know how to do it server side by calling the Page.Validate("grou...

OnSelectedIndexChange only fires on second click when using custom page validation script

Okay.. this is hard to explain, so here it goes. I have an update panel which contains a number of controls. The update panel is triggered by the OnSelectedIndexChanged event of a dropdownlist called: ddlUSCitizenshipStatus. It works as expected when I selected a new item. However, if I leave ddlUSCitizenshipStatus with the default v...

Rules: Client-Side validation vs. Server-Side validation?

Are there are any rules for when to use Client-Side validation and when to use Server-Side? ...

PHP form validation question?

I have a form that validates the email address and I want to be able to place echo '<p class="error">Please enter a valid email address!</p>'; anywhere on the web page without having to put the validation process within the html? Or should I include the validation process in the HTML form? Here is the php code. if (preg_match ('/^[\w...