validation

NHibernate Validator and Schema Export question

I'm learning to use NHibernate validator and it's Fluent API (Loquacious). I have noticed is that I can't set an integer property or nullable int property (int?) to be not nullable. Well, why not? In a database, an integer column can have null values. Even worse, when I generate DDL using SchemaExport, the integer column wont be pickin...

Prism IDataErrorInfo validation with DataAnnotation on ViewModel Entities

Hi, I'm implementing data validation in WPF using the Prism MVVM framework. I'm using clean data Entities in the ViewModel which are being bound to the presentation layer. <TextBox Text="{Binding User.Email, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" /> I've implemented a generic implementation of IDataErrorIn...

Validate allowed filesize from user input like files to save in local database

Hello, I can not allow my user to save a 6 GB video in the sqlite database. Can I not really? Well all freedom to the user not? Should I protect the user from himself? Where do I draw the border? 1 mb? ...

Django, unable to import validators in form class, getting "name 'validatorname' is not defined"

I am trying to use validators in my form fields but am getting an error: from django import forms from django.db import models from django.core.exceptions import ValidationError class Register(forms.Form): username = forms.CharField(max_length=100,label="Username",validators=[validate_email]) >>>> name 'validate_email' is not def...

XHTML Transitional rel attribute alternative

I'm trying to add some custom data within a tag to reference later in a jQuery call, and I usually use "rel=" for something like this. However, I'm working in an XHTML Transitional document, and it gives me a "there is no rel attribute". Are there any alternate attributes I can use to attach custom data to an HTML tag while still kee...

Validating data before inserting into database

I want to validate the data contained by Value Objects before inserting into the database (e.g. check that php string is smaller than 255 chars before inserting into a column of type varchar(255) or that a string is not inserted in an int(11) table column, php date has the correct format etc.). Is there any framework or easy way to vali...

MVC Clientside validation in jqModal window

I have a simple form with standard MVC Clientside Validation (minimalist sample: one text box displayed with standard LabelFor/TextBoxFor/ValidationMessageFor sequence. The model property is marked with the [Required] and [StringLength] attributes.). It works exactly as expected if I navigate to that form (i.e., http://localhost/Batch...

select first empty form field

I'm checkin a form for empty values via the following method $("#reservationForm").find("input[type=email], input[type=tel], input[type=text]").filter(function(){ if($(this).val() == ""){ $(this).css("border","solid 1px red").after('Please fill in your '+this.id+''); f.preventDefault(); } Now i wan...

Zend Framework VS jquery validate Vs Form

Just a quick question if someone has already that kind of setup or if there is some source code on the web. I want to add some javascript validation to some Zend Forms. The straight forward approach would be to write the javascript myself but let's say it's time consuming(and that's not the kind of code your really want to write all da...

Does it make any sense to use JSLint and follow it?

Lately I've been writing some JS code using jQuery and JavaScript as it is and I thought I will give JSLint a try. Let me say that the code contains various functions and jQuery usages and it works fine (without any errors ) in IE8 and latest Firefox. The code also validatas as XHTML 1.0 Transitional (and Strict too but I mostly want it ...

Supress HTML Validation Error in Visual Studio

I have a custom attribute that I use in various elements in my ASP.NET HTML markup. Obviously it violates the DTD, and I get a validation error from Visual Studio. I hate ignoring errors in the error output window. Is there a way to suppress this error message? For example: <label id="MyId" cid="MyCID" runat="server" /> cid is a custo...

DataAnnotations or validate manually in services?

Each time I start working on a new ASP.NET MVC web application, I'm not sure whether or not to use DataAnnotations validation. Something about it feels wrong. For example, let's say I have a UserService which is passed a CreateUserModel from the Create action of the AccountController. To ensure the user always supplies a name, I set the...

Enforcing valid input in Java

I have a class I wrote in Java and one of the methods is getCommand() The purpose of this method is to read in a string and see what the user typed in matches any of the acceptable commands. This is how I wrote it initially: public char getCommand(){ System.out.println("Input command: "); command = input.nextLine(); whi...

Can I format my validation strings with relevant info in Kohana 3?

I've noticed in Kohana 3 these error messages provided by default. return array( 'not_empty' => ':field must not be empty.', ); Obviously, :field is replaced with the field name. Now I am validating an image upload. Obviously, I'm allowing only JPG, JPEG, GIF & PNG. I have an error message set up like so. return array( 'pho...

validation error [ There is no ID/IDREF binding for IDREF ]

I am getting this error message when validating my XML file against its Schema. Can anyone suggest what might be wrong? The XML file is: <?xml version="1.0"?> <family-tree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ftree.xsd"> <person id="p5"> <name> <given>Al Frank</given> <surname>Smith</surn...

Enterprise Library Validation Block - Validate conditioned to another property value

I need to validate two fields only if a third field has a specific value. In this code snipper i suppose to use a CheckIf properties that not exist. It is possible to validate a field only if another property hase a specifica value ? public string CustomerType { get; set; } // P=Private B=Business [NotNullValidator(MessageTemplate = "Y...

ASP.NET request validation with HTML encoded characters.

I have a textbox in a form which needs to accept input with HTML tags. Submitting input with HTML tags in makes the app throw a HttpRequestValidationException, unless we use HttpUtility.HtmlEncode. Easy so far. However, the input may also contain symbols, such as the 'degrees' symbol (°). When these are also HTML encoded, they become n...

JSF: Validate value provided in both fields or none of them

I have two fields representing data range ("from" and "to"). I need to check if either both fields are filled on none of them, so only moment there should be validation message shown is when one is filled and not second one. How can I do that? I thied this custom validator and add it to both fields (as JSF doesn't validate empty fields) ...

How to validate extra field in form? CAKEPHP

i am creating a form with a check box called "agreement", the user must click this to confirm that he has agreed to the agreements. But how do i add this to the validation? can i do this from the model? this is a field that is not in the database. im stuck here. ...

Entity Framework Contextual Validation

How would you implement validation for entity framework entities when different validation logic should be applied in certain situations? For example, validate the entity in one way if the user is an admin, otherwise validate in a different way. ...