validation

RegexValidator does not work for char?

Hello, Why the following test does not fail? [TestMethod()] public void tip_cicluTest() { MyBO target = new MyBO() { tip_ciclu = 'S' }; char expected = 'S'; char actual = target.tip_ciclu; Assert.AreEqual(expected, actual); ValidationResults vr = Validation.Validate<MyBO>(target,"vali...

How do I validate for language? ASP.NET

In a textbox in the application, I need to validate to ensure that a user enters only English language text. I know some languages such as Spanish share English's alphabets. How do I validate text to make sure it's: Only in English language Supports only languages that use the English character set (Spanish etc) Thanks EDIT: Sorry f...

jQuery iterations with validation

I have about 40 questions in a survey that need to be validated all the same way. What's the easiest way to do this without writing every validation down? For example: Every question must be a natural number, maxlength of 2, and value less than 12. Using jQuery validation ...

Linq to Entity Model's DataAnnotations don't reset

In my Asp.net MVC app, I have a custom validator class V and an (ADO.NET Entities) entity model E. class V : ValidationAttribute { public override bool IsValid(object value) { ... if (hasErrors) ErrorMessage = errorMsg; ... } } public partial class E //the entity m...

NotNullValidator problem

Hello, I'm using Microsoft Enterprise Validation Library. If i have a [NotNullValidator(MessageTemplate="Cannot be null!", Ruleset="validate_x")] public string x{ get; set; } and then, in a test class i have: MyBO target=new MyBO { x=null }; and i wanna check if this is valid (using ValidationResult), and also that ruleset, the test...

Render w Params or Redirect w Errors in Ruby on Rails

I am using ruby on rails and have things on my site that users can click to save and they are redirected to a page with both a login and a signup so that the user can continue with either option and save the content. The creates a problem for showing the proper user validation errors, b/c I need to use a redirect_to users/new in order t...

Why NotNullValidator does not work?

Hello, I'm using Microsoft Enterprise Validation. But in this case the test passes, even if i assign null value to that attribute. Why? [NotNullValidator(MessageTemplate = "Cannot be null!", Ruleset="validate_x")] [StringLengthValidator(10, RangeBoundaryType.Inclusive, 40, RangeBoundaryType.Inclusive, Ruleset="validate_x")] ...

Strange behaviour of NumberFormat Java

Hello, I have the following code to parse a String variable called str. NumberFormat formatter = NumberFormat.getInstance(); Number number = formatter.parse(str); I want to catch the Exception thrown when str is not a number just to validate it. The problem I have is that it does't always throws the ParseException expected. When the ...

MS Validation Block or Workflow Rules engine?

For a large application that will be developed, we are in the process of selecting a Validation framework. Although the Workflow Rules engine is not strictly a Validation framework, it can be used by itself without using the Workflow foundation. It appears to give flexibility of specifying the rules in a database that is used at runtime....

How to validate string against XML schema entry using .Net

I have a string (source string) and XML schema string. How do I validate this string against the schema entry? I do not need to validate whole XML document, just check if the string matches the certain XML schema entry. I found it extremely cumbersome to wrap the string to XML document and then validate against all the schema, is ther...

"someVariable cannot be resolved" error indicated in Eclipse for an included JSP

So I have a main JSP index page, "index.jsp", which has several includes. Something like, <%@ include file="/WEB-INF/views/includes/jstl/include.jsp" %> <%@ include file="/WEB-INF/views/includes/licenses/license.jsp" %> <%@ include file="/WEB-INF/views/includes/generalHtml/header.jsp" %> <%@ include file="/WEB-INF/views/includes/navigat...

xVal Client Side validation

I am using xVal for validation in my Asp.Net MVC 1.0 project. I am running into an issue where the default DataType validation and error message is being thrown and overriding my custom RegEx error validation and message. Here is my model with the property I want to force validation on: [Required(ErrorMessage = "Year Published is re...

Find the first character of input in a textbox

I am stuck in implementing the following: User starts typing in a textbox. The javascript on page captures the first character typed, validates that it is an english alphabet (a-z,A-Z) and converts it to lowercase (if necessary). Make an XMLHttp request based on the input (i.e. if first input character is a, get a.xml, if b get b.xml a...

jquery Validation plugin

I am trying to figure out how to show validation error messages on my registration page. For jQuery Validation plugin examples they use a class called "require" for required fields. Is that what I have to do to include the required field validator? I guess I don't understand how this plugin works. If somebody could explain this it would ...

validates_presence_of + :message shows the name of the field

Hello, I'm creating a Rails app, and I have a model called User. In this model I have a boolean value called isagirl. A user must specify if it is a girl or not, which is done by two radio buttons. In my model I have this: validates_presence_of :isagirl, :message => "You must be either a Boy or a Girl. If not, please contact us." How...

WinForms TabControl validation: Switch to a tab where validation failed

Hi, I currently have a Form with a TabControl containing some TabPages. Each TabPage has several controls with validation logic and appropriate ErrorProviders. On my OK_Button_Clicked event, I call Form.ValidateChildren() in order to determine whether to save and close the form . Now, suppose I have a control in tab 1 that fails validat...

Model Validation problem in ASP.NEt MVC 2 RC 2

Hi, I have facing the following problem after the update. I have a Model with Class level Validation plus property level validation in it. After updating to MVC 2 RC 2. The model validation fails on Model binding. What i actually understand that new mechanism trying to validate the model when you first request it or say on GET and it ge...

JPA validation strategy

NetBeans let me choose between three values for the JPA validation strategy: Auto, Callback and None. What does "Auto" mean? Does "Callback" mean the use of @PrePersist, @PreUpdate, and @PreRemove? Is there a performance hit if I use Auto or Callback if there is no validation to perform? ...

How do I validate that two values do not equal each other in a Rails model?

I have a User model, which has an email and a password field. For security, these may not be equal to each other. How can I define this in my model? ...

Designing Business Objects to indicate constraints such as Max Length

Is there a standard convention when designing business objects for providing consumers with a way to discover constraints such as a property's maximum length? It could be used up in the UI layer to, for example, set a Textbox's MaxLength property according to the maximum length limit back in the business object. Is there a standard ...