validation

WPF Validation: Styling/templating validation properties

I have a WPF screen that displays a number of TextBox inputs. I have a style that handles all the validation: <Style x:Key="TextBoxStyle" BasedOn="{x:Null}" TargetType="{x:Type TextBox}"> <!-- etc etc --> <Setter Property="Validation.ErrorTemplate"> <Setter.Value> <ControlTemplate> <Border Gri...

Embedded YouTube code does not validate

While validating my not be a big issue to some people, I personally want my page to validate whenever possible, as I feel it's a good habit to code properly whether the compiler/browser/person reading your code understands anyways. Anyways, I'm building a website for a client that is requesting a YouTube video of theirs be embedded in ...

Rails 3: Custom error message in validation

I don't understand why the following is not working in Rails 3. I'm getting "undefined local variable or method `custom_message'" error. validates :to_email, :email_format => { :message => custom_message } def custom_message self.to_name + "'s email is not valid" end I also tried using :message => :custom_message instead as was sug...

ASP.NET MVC 2 Data Annotation Validation -- StringLength Minimum not working on client-side

Hi. On one of my models I have a property annotated with: [StringLength(60, ErrorMessage="Title must be between 60 and 10 characters", MinimumLength=10)] When the form posts to the server, if it's under 10 characters, then validation fails as it should do. However, on the client-side, it only checks that it's under 60 characters -- n...

Bubbling of Rails3 validation? Custom validate vs. validates_presence_of

I have two validations.. validates_presence_of :name validate :category? In my category? validation, it asks for a Model.category.downcase method. I made a spec where no category exists, and it is failing in my specs because no category exists for it to downcase. My question is, how do I set up my model to first validate if the name ...

Rails 3: Validate IP String

In Rails 3, is there a built in method for seeing if a string is a valid IP address? If not, what is the easiest way to validate? ...

Defining a specific field value as semantically equal to empty in jQuery validation.

Hi! I have a very large Form with many date fields that need to be validated. For the most part, this is pretty straight-forward to do with the jQuery Validation plug-in. But I have found a use-case, where I am not exactly sure that the "correct" design decision is: I have a date-field whose value is by default an abstract example : ...

CausesValidation to certain fields

I have a large ASP.NET page with many TextBoxes and Validators The problem is that when I click on a button, I want to fire the validation for certain TextBoxes (but not all of them). And when I click on another button, I want to fire all of the validators. ...

Why can't the upload field select a new file after jQuery-validate returns an error?

Hello. I'm coding a form using PHP and jQuery. I have a file upload field to which I applied the following jQuery-validate rules: image: { accept: "jpeg|jpg|png|gif", required: "#edit_ID:blank" } The file upload field must only accept jpeg/jpg, png, or gif images. It is required only if the field with the ID "edit_ID" is left blan...

Getting Duplicate Error Messages with JQuery Validation Plugin

I'm a newbie to JQuery and the Validation plugin. Short Description: I wanted all of my error messages to appear in one div at the top of the form, instead of next to each label. After a little head scratching and net searching, I came up with the following, which works, but the sourceurl: message comes up twice on the validation. I ...

Django: Validation on a Many-to-Many Through model

I have the following models (simplified example): class Book(models.Model): users = models.ManyToManyField(User, through=Permission) class Permission(models.Model): user = models.ForeignKey(User) role = models.ForeignKey(Group) active = models.BooleanField() book = models.ForeignKey(Book) What I need is that for a Book instance ...

Custom javascript validation

Hi guys, Is there any way to show custom input validation message through javascript? I have javascript validation method innvoked with Form.Submit, so if validation goes wrong, I'd like to have a custom text next to the field I have validated (similar as ASP.NET MVC 2 validation summary). Regards ...

Is Regex for Form Validation if I use the following?

I know there is no harm in adding it either way but I'm curious... If I was to use htmlentities(); with ENT_QUOTES and then mysql_real_escape_string(); the variable before entering it into the Database, then just use html_entity_decode(); along with stripslashes(); to display the information... Would this still be safe and secure? ...

does mvc.net validation support the concept of ValidationGroup

Coming from the asp.net background, I really appreciated the concept of 'validationGroup' when adding validation to a page. I've been searching for a corresponding concept within mvc.net and haven't had much luck. Is this concept available in mvc.net? If not, what alternatives do I have? ...

Using Jquery Validation Plugin's required( dependency-expression )

Hi I'm using the jQuery Validation plugin, and I'm trying figure out how i can make a name field required if a prefix (Mr, Ms, etc) or a suffix (Jr, Sr, PhD) is selected. This is what I have: $('#geninfo').validate({ rules:{ firstname: {required: function(element){ return $("#prefix").val() != " "; } } }, mess...

Detect SQL Injection

I came to a company that already has a fully grown project... but coders that worked here before me didn't follow conventions and didn't use parametrized SQL queries... as a result there is over 1000 places in a very huge project that can possibly be vulnerable to SQL injection... I need to find a solution that will automatically detec...

jQuery reset dialog on cancel and close before form posting

I have code that opens a dialog, validates, and posts a form when the validation is successful. If the user clicks "Cancel," the dialog should reset until the next time it's called. If the user clicks "OK," the dialog should close and the form should post, so if I hit the back button the dialog doesn't appear on the page. Code is as f...

Validating input in multi-lingual application

I'm working on an application that will support both english and arabic languages. The application takes numeric input for use. In arabic language, the numeric characters are different! So, what's the best way to validate numeric input (amount, percentage, number) in such a situation? ...

Better name for "non-negative" value?

I'm validating that the integer is zero or greater. To describe the requirement as "zero or greater" feels too verbose. To say "non-negative" introduces negative language, which I try to avoid when I can. What concise descriptor do you use when describing a value that must be zero or greater? ...

asp.net mvc2 validations

I am using DataAnnotations for validation (including client side) I have a form with multiple fields. Basic validation for individual fields work fine. Now there are a couple of fields of which atleast one needs to have a value (if there are 3 fields then either 1st or 2nd or 3rd field should have a value). I have read quite a few pos...