validation

how do i validate the presence of a field only if another field was edited in rails?

Hi All, I have a table with a column called lifecycle_id, and another called lifecycle_change_reason. lifeycle_id is normally changed automatically by the system based on other factors, but certain users have the ability to change the lifecycle manually. if they do, I would like to require them to provide a reason for the change, but I...

null values from listbox, are not evaluated in the model binding of ASP.NET-MVC

The model validation doesn't evaluates the attributes linked to listbox values if you don't select at least one of them. This way is not possible to do a model evaluation using DataAnnotations in order to inform required values. The controller: using System; using System.Collections.Generic; using System.Linq; using System.Web; using S...

Form Validation in WPF

I have been working with WPF and the MVVM pattern for a while now. I'm having difficulty getting validation working in a "normal" way: 1) I'm implement the IDataErrorInfo interface in my ViewModel. The XAML looks something like: <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Path=ProjectKey, ValidatesOnDataErro...

WPF Conditional Validation

I'm having problems validating an email address in my View Model. Property I'm checking is - [ValidatorComposition(CompositionType.And)] [SOME Operator("EnabledField")] [RegexValidator("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*", Ruleset = "RuleSetA", MessageTemplate = "Invalid Email Address")] public ...

How to use a static class method as a filter for Kohana's Validation Library?

Kohana's Validation library has a pre_filter() method which lets you apply any PHP function to fields to be validated, as trim(), etc. I tried to use a static method as a filter, but won't work: $validation->pre_filter( 'field_name', 'class::method' ) What that does is create two filters, one with class and antoher one with method. A...

How can I validate a "yyyy-MM-dd'T'HH:mm:ssZ" date/timestamp in UTC with Perl?

Code would be nice but a point in the right direction is good as well. CPAN? RegEx? I've seen both ways "yyyy-MM-dd'T'HH:mm:ssZ"; "yyyy-MM-ddTHH:mm:ssZ"; ...

How to declare a namespace in WPF XAML?

I am trying to use in WPF a validating input of databound controls with validation rules. In the code behind file of a wpf window I have a class: public class posintValidationRule : ValidationRule { public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { ...

Raising Errors on Failed Validation

Please check out the code HTML Code: First Name: <input type="text" name="fname" id="fname" > <p id='p1'></p> Last Name: <input type="text" name="lname" id="fname" > <input type="submit" name="submit" value="Submit" onclick="return validate_form();" > Validation Code: function validate_form() { if ( document.form.fname.value ...

Services to suggest changes in markup to improve search-engine friendliness (think W3Cs validation services)

Are there any services out there, that can parse a website and give some sort of feedback to how search-engine friendly that website is? And perhaps even suggest changes to the mark-up to improve indexing? Think W3Cs validation services. ...

Ovveride validation method in CakePHP

I want to ovveride the default url() validation method in CakePHP, since it does not allow the use of ~ inside urls. I thought it would be enough to declare a url() method in AppModel, but it seems that core methods have the precedence with respect to user defined ones. I think (but I have not tried) one possible way would be to use $v...

Validating a SelectList in ASP.NET MVC 2 with Data Annotations

I'm trying to use the built in ASP.NET MVC 2 client side validation on a Select List like the following: private SelectList _CategoryList; [Required(ErrorMessage = "Category Required")] [System.ComponentModel.DataAnnotations.Range(1, double.MaxValue, ErrorMessage = "Please Select A Category")] [DisplayName("Cate...

.Net - DataAnnotations - Validate 2 dependants DateTime

Let say I got the following classes : public class Post { public Date BeginDate { get; set; } [Validate2Date(BeginDate, EndDate, ErrorMessage = "End date have to occurs after Begin Date")] public Date EndDate { get; set; } } public class Validate2Dates : ValidationAttribute { public Validate2Dates(DateTime a, DateTime...

How to distinguish form values in duplicate forms using AJAX (jQuery)

Hi, I have a page that contains several forms that are identical throughout a page. I submit these forms using the $.ajax() method. As I see it using classes to identify/submit/validate the individual forms will likely be problematic. Passing the form with something like $('.someForms').serialize() would not produce viable results. H...

jquery validate: focusCleanup: true and focusInvalid: false don't work as expected

I am using Joern's jquery validation plugin 1.6. My goal is to have the following behavior: remove the error message for an element once the user focuses it. From what I understand setting 'focusCleanup: true' should take care of this. However (at least on my browser (Firefox 3.5.7 on Linux)), I only get the desired behavior (ie, error...

How to show WPF ValidationResult in a seperate textblock?

I am trying to use in WPF a validating input of databound controls with validation rules. I have a posintValidationRule class: public class posintValidationRule : ValidationRule { public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { string _strInt = value.ToStri...

How do I hide a div (on the client) is client-side validation fails?

Hello all, I'm making an asp.net page with asp.net validation controls. If validation fails, I want to show a div (on the client). Where do I do this? I can't find a way to access the OnValidate event on the client. I can do this on the server, but I'd rather do it on the client. ...

Best way of validating/creating a number only text-box?

Hello, I am wanting to have a numbers/currency only textbox control. So basically it should accept this kind of input $123 523,100 $12.50 85.59 and convert this to 123 523100 12.50 85.59 and should not accept this input F12 309$2342 ,102 I have looked at validator controls but I would like to this conversion/checking complet...

Validating form input and running a function only if it passes

In my .NET porject, I have to run a lot of validation on 4/5 fields. This validation checks if certain fields have errors, for example: the name field is not allowed to have numbers or symbols. If all these checks are passed, I need to execute a SQL query to pull some data out of the database. I could have it with a lot of nested IFs, a...

risky characters to block in asp.net forms?

hi, I'm about to launch a forms auth membership site that will include forms that both international and American users can use to update their profile info and submit requests for info on products (but no actual e-commerce). I'm using asp.net validation controls on the text inputs and I had it pretty tightly filtered for chars using re...

Regular Expression to validate the field: field must contain atleast 2 AlphaNumeric characters

I need to validate VARCHAR field. conditions are: field must contain atleast 2 AlphaNumeric characters so please any one give the Regular Expression for the above conditions i wrote below Expression but it will check atleast 2 letters are alphanumeric. and if my input will have other than alphanumeric it is nt validating. '^[a-zA-Z0-9...