validation

How to define alpha or alphanumeric rules for a ORM model using Kohana 3?

I'm doing this in my model.... protected $_rules = array( 'id' => array( 'not_empty' => NULL, 'numeric' => array(TRUE) ) .... Am I doing it right for the numeric qualifier? Thanks. ...

Need to press submit twice for submitting a form with ajax (jquery validation plugin)

The form is validated before submit with this plugin. And submitted as shown in the code: jQuery.validator.setDefaults({ submitHandler: function(){ jQuery("form").submit(function(e) { e.preventDefault(); jQuery.post(base_url + "blog/ajax_comment", { author: jQuery("#author").val(), email: jQuery("#email").v...

Javascript validation using activerecord models validators

I have an activerecord model and set of validators to it, But I also have to provide front end validation. Is there a gem or a smart way to use activerecord validators, for instance in jquery validation plugin, instead of writing it by hand? Thanks ...

Silverlight: Validate as soon as user focuses on a text box?

I'm building a SL4 app. Currently, my validation works for the following scenario: User focuses on the text box User types invalid data User loses focus on the text box However, it does not work for this: User focuses on the text box, which already contains invalid data User loses focus on the text box How can I get validation to...

INotifyDataErrorInfo ArgumentOutOfRangeException when raising ErrorsChanged event

This is a wierd one and at this point I am thinking that it may have something to do with my machines configuration. Basically I have created a pretty standard implementation of INotifyDataErrorInfo and in certain circumstances, when raising the ErrorsChanged event I get an ArgumentOutOfRangeException. This exception doesn't contain muc...

How to implement reCaptcha into my signup form?

Hi there, I am kinda new to php and i am trying to figure out how to make recaptcha work on my site. Here is an excerpt from my "signup.php" and i have corresponding signup.html which acts like a template... The head part of it looks like below... <?php require_once('includes/config.php'); require_once('includes/functions/func.global...

How to "Validate" Human Names in CakePHP?

I have a PHP script that is supposed to check for "valid" human names, but recently cracked against a name with a space, so we added spaces to our validator. Rather than doing this, is there a way to add a blacklist to CakePHP's validator to block all "invalid" characters, rather than allowing "valid" ones? NOTE: I know how to do this...

Apply Server Side Javascript Validation in Grails

Hi All... I am working on grails project where I need to apply server side validations. For client side validations I have created basic validation.js file which contains all the javascript functions. Now what should be the ideal way to achieve the server side validation using Ajax, to achieve the validations like Record Duplication c...

django manytomany validation

Please see the code below. Basically, when the user creates an object of this class, they need to specify the value_type. If value_type==2 (percentage), then percentage_calculated_on (which is a CheckboxSelectMultiple on the form/template side needs to have one or more items checked. The model validation isn't allowing me to validate lik...

Using C#, how do I validate a html file?

Hi, I have a C# application that receive a html file, I want to parse it and validate it, that on output it will return a list of errors or that my html is valid. Has anyone any idea how can I do this? Thanks. ...

How to AppendSignaturePropertyCriteriaTo ValueObject

I use Sharp Architecture 1.6 and run in to an issue with EntityDuplicateChecker. I have an Entity with 2 properties as domain signature, (int) CustomerId and a ValueObject that represents a week(consist of year and a weeknumber). So in DB terms there is a domain signature on 3 columns, CustomerId, Year and WeekNumber. EntityDuplicateC...

Validate dropdownlist selectedvalue against a list from static property

Hi, I am using javascript to validate user input on my aspx page. I am easily able to validate textboxes and dropdown list for differenet scenarios. Now, on one of my dropdown lists (for country), I need to check if it is an allowed country or not for a particular service. I have stored the valid country list in a static property. Is ...

WPF TextBox setting Text using Trigger during validation

I am having a requirement where in I have to revert the values of a TextBox to old value when the user enters a wrong input. I am using MVVM framework so I dont want to write any codebehind. The Text and Tag of TextBox is databound from ViewModel variable. So my Tag field of TextBox will always have old value. I want to use the Tag field...

Validation of all rows of a grid

Hello I have a grid in which I show the data contained in my ViewModel. The validation is done with the IDataErrorInfo on each single row. So every time that a row is added/updated the validation is called on that row. I would like to validate all the data contained on the grid when a single row is updated because the rows are interdep...

How to do Data Annotations on an object in another Assembly?

I have an abstract domain object that is consumed by both a web and windows application. This domain object sits in a an old namespace along with any derived classes. For my web application I would like to use data annotations. Usually I would create a partial class to the domain object and provide it a MetaData class. However, I am una...

jQuery - Scrub data in all textboxes/textareas in a form?

My buddy at work told me that you could use jQuery to write a few lines of code that would find a single character (in this example '\0') and replace it for all textboxes and textareas on the page. Of course, he didn't tell what lines of code would do that ... Is there a simple way to do this? We have a problem of people copying data ...

How to localize ActiveModel error messages in Rails 3?

class User include ActiveModel::Validations validates_presense_of :first_name validates_length_of :last_name, :in => 3..20, :too_long => "pick a shorter last name", :too_short => "pick a longer last name" attr_accessor :first_name, :last_name end How do you localize error message(s) for :first_name localize error message(s) ...

WPF ValidationRule with dependency property

Suppose you have a class inheriting from ValidationRule: public class MyValidationRule : ValidationRule { public string ValidationType { get; set; } public override ValidationResult Validate(object value, CultureInfo cultureInfo) {} } in XAML you are validating like this: <ComboBox.SelectedItem> <Binding Path="MyPath...

WPF Validation: Is there a way to add multiple errors to a field?

I use Validation.MarkInvalid to set errors to field. Is there any way I can set more than one error for a field? (I'll then use the converter described here to show them) MarkInvalid seems to be ignored if an error is aready set for a field. ...

while validating in cakephp, what 'validate'=>'first' does?

I have written in my code like this... $this->User->saveAll($this->data, array('validate'=>'first')); $this->User->saveAll($this->data, array('validate'=>false)); 'validate'=>false will not check for validations in model. But if I replace false with first, then what will it do? Thanks. ...