validation

How do you get model metadata from inside a ValidationAttribute?

MVC2 comes with a nice sample of a validation attribute called "PropertiesMustMatchAttribute" that will compare two fields to see if they match. Use of that attribute looks like this: [PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessage = "The new password and confirmation password do not match.")] public class ChangePass...

jquery validate: adding a required rule with custom message based on wether a different form field has a value.

Hello Everyone, I know this seems like a repeat question, but i've read all the others and they arn't quite the same :( I've got some drop downs, and if they have something other then an option with a value of "0" selected then I want the coresponding Expiry Date field to be required. I tried putting the rule in the class of the...

ASP.Net Dynamic Data - DataType Validation

Hi Dynamic Data question: I have 2 fields of type Nullable<DateTime> on my model When I use the insert form and enter a garbage string e.g. "sdfsdfas" for a date it gives me an ugly error message Unable to convert input string ' rtgh' to type 'System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyTo...

JAXB validation using annotations.

If I have a simple class such as:- @XmlRootElement public class MyClass { @XmlAttribute(required=true) private String myattribute } Is it possible to validate a corresponding xml document WITHOUT an xml schema i.e. using only the annotations? ...

jQuery validation plugin. errorLabelContainer does not work after post back

Hi! I'm using the jQuery validation plugin. I have my form on the master page, i set up my validation rules in one of my aspx pages like this: $("#aspnetForm").validate({ errorLabelContainer: $("ul", $('div.error-container')), wrapper: 'li', onkeyup: false, rules: { ctl...

Validating disconnected POCOs

In my ASP.NET application I have separate projects for the Data, Business and UI layers. My business layer is composed of plain objects with declarative validation, using DataAnnotations. Problem is, when it comes to save them, I'm not sure how to process the validation, since they're not bound directly to any data context, but rather,...

Validators blocking navigation in asp.net ajax

I am encountering issues in the navigation defined in a master page which are being blocked by validators pages that inherit from the master. How can I disable these validators so that they do not prevent my button actions in the master page? I am using AJAX controls in child pages. ...

Automatic Set Japanese on Textfield focus

Hi . I have a web application. It is running on struts framework but i dnt think it's relevant to my question. :) I want that when I click or put my cursor on my textbox I can directly type japanese katakana, hiragana and kanji characters. Windows has this IME which enables you to type these characters by enabling japanese or any lang...

Validating integer field with custom model binder in ASP.NET MVC

I ran into an issue that I thought was interesting. Take an input form that has an input field for an integer value (cost, in my case). I do not want "$100" or "Twenty Dollars" to be sent to the database as it will likely complain. I want to add an error to the model and send it back to the user. Seemed simple ;). I am using a cus...

XML Validation Confusion

I'll admit, I'm an XML newbie. I'm having trouble validating some xml against a schema. Here is the relevant part of my schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.me.com/orpm/kpi/automation/report" targetNamespace="http://www.me.com/orpm/kpi/automation/...

Drupal form validation not working for me

I am trying to modify some Drupal 6 form code and incorporate some native form validation. Code looks like this, but validation does not work. I never even get into function thisFormName_form_validate. Any Drupalians have some good ideas? function thisFormName_form_alter(&$form, $form_state, $form_id) { $form['email_address'] = arr...

Should I use Bean Validation with EJB 3.1, JSF2.0 and JPA?

I have a JSF 2.0 application that I would like to start adding validators for. A basic overview of the architecture of the app is as follows. I have Managed Backing Beans that contain instances of my JPA annotated classes and EJB's. The EJB's are responsible for accessing the database transactionally. The JPA annotated classes are value...

Why does known valid Django model instance fail is_valid() after retrieval from database?

We have a Django Model, ToolDataset, and a ModelForm, ToolForm. In the Model each instance, or database row, is referred to as a dataset, and the primary key is called the dataset_id. First time through, the user fills out an unbound form and submits it. Conceptually, this is the view code that is used to validate, save and analyze the d...

Recommendation for a ASP.NET Webforms Validation Framework

I have worked with the .MVC framework using validation frameworks such as xVal or FluentValidation. Is there anything similar available for webforms as well? I have got a few projects which have to be done using webforms. What I'm asking for is some kind of integration with the webforms infrastructure. I could just use one of the menti...

PHP Ajax Captcha(Securimage) issue

Hi, i have a little problem with captcha validation using php and ajax. this is the php validation: if(trim($code) == '') { $error_captcha = '<p class="error">some empty error....</p>'; $errorc = 'error'; $error = $erdiv; } else if (trim($code) != ''){ require_once ('securimage.php'); $captcha = new Securimage(); $valid = $captcha->c...

about jquery pageLoad() ? plz help

Hi, I am using jquery to disable validation controls in aspx page on load and than on button press I want to enable them. I have coded the below mentioned script for this. but there is an issue. Both functions (enabling and disabling validation controls) are fired on page load. Please guide me on this. thanks <script type="text/javas...

Validation of ViewModel throws exception

Hi, I have a viewmodel that contains a product and SelectList of categories. public class AdFormViewModel { public AmericanAds.Model.Ad Ad { get; set; } public SelectList Categories { get; set; } public AdFormViewModel(AmericanAds.Model.Ad ad, SelectList categories) { Ad = ad; Categories = categories; ...

How to disable the validation (or the drop-down) in SharePoint EditForm.aspx when doing dynamic cascading drop-downs?

In Sharepoint - EditForm.aspx, I am doing dynamic cascading drop-downs. Adding drop-down values dynamically using Jquery. Values are not there in the choices list of the drop-down. When I click OK button I get "Invalid postback or callback argument.Event validation is enabled using in configuration or <%@ Page EnableEventValidation="tr...

Testing for numeric input with regular expression

I have the following regular expression: ^[-+]?[\d{0,3},?\d{3}]*\.?\d+$ I am trying to support numbers of the following formats: 1 -1 -1.00 100,000 I am not concerned about scientific notation but my users may or may not enter in commas. The problem I am having is that the expression is matching: 100, 100,00 How can I have t...

regular expression for first and last name

Hello I am very naive with regular expressions and I wasn't really able to find what I need. For website validation purposes, I need first name and last name validation. For first name it should only contain letters and can be several words with space and no letters and as minimum 3 characters and at top 30 characters. Empty string sho...