validators

EntLib validation syntax for optional field rules?

I have an field, Address2, which is optional. Thus if it is null, no validation rules apply. However, if a value exists, its length cannot be greater that 255 characters. I have been toying with: <StringLengthValidator(0, RangeBoundaryType.Inclusive, 255, RangeBoundaryType.Inclusive, MessageTemplate:="Address 2 can be between 0 and 2...

Java fields validation mechanism

Hi, Can you recommend any mechanism/technology/3rd party jar that does field validation (like field length validation, regexp validations and so on..)? It's important that it would be highly configurable - meaning that I would be able to map between fields to a set of validations or something of that sort. Perhaps it should have also...

ASP.NET: aggregating validators in a user control

I am developing a web application where I would like to perform a set of validations on a certain field (an account name in the specific case). I need to check that the value is not empty, matches a certain pattern and is not already used. I tried to create a UserControl that aggregates a RequiredFieldValidator, a RegexValidator and a Cu...

Writing a rails validator with integer

I was trying to write a validation for Rails to ensure that a price entered on a form was greater than zero. It works…sort of. The problem is that when I run it, val is turned into an integer, so it thinks that .99 is less than .1. What's going on, and how should I fix the code? class Product < ActiveRecord::Base protected def sel...

Tab container - Button event is not firing

Hi experts, In tab container let say I have two tabs [Tab1 & Tab2] Tab1 has 2 text box with required field validator Tab2 has 3 text box with required field validator Now even if I am filling all the text boxes in the TAB1, it is not allowing me to postback. [because TAB2 text boxes are still empty] & When I am filling all the text...

How can I modify the error message for the required / notempty validator in the ini file

I'ld like to configure my forms using config with an ini file. I need individualized error messages like the following one: suche.elements.methode.options.validators.strlen.options.messages.stringLengthTooLong = "Der Suchbegriff '%value%' ist zu lang!" This works well for strlen and regex, but how do I set it up for "required" element...

ASP.NET: Validate text box contains integer greater than equal to zero?

If I want to validate that a text box contains an integer greater than or equal to zero. Do I need to use TWO asp:CompareValidator controls: one with a DataTypeCheck operator and one with a GreaterThanEqual operator? Or is the datatype operator redundant? Can I just use a single validator with the GreaterThanEqual operator (and the ty...

Looking for an example of a Validator inside a user control

Is it possible to have a validator inside of a User Control? If so, does anyone have a snippet of code from a working example? ...

IValidator.Validate method and adding error message to a custom type

I have several server controls that implement the IValidator interface. As such, they have their own Validate() methods that look like this. public void Validate() { this.IsValid = true; if (someConditionFails()) { ErrorMessage = "Condition failed!"; this.IsValid = false; } } I understand that these Validate() methods ...

.Net framework 1.1 web application on Safari

We have an intranet web application developed using .NET framework 1.1 The application has few validators and fired from the server side (They are not client side validators). The web application runs perfectly fine on IE and Firefox (both on Mac and Windows). However on Safari(ver 4.0.3) browser running on Mac, the application intermit...

Validators are not working anymore in Zend Framework?

Eariler I happily used the following code for creating form elements (inside Zend_Form descendant): //Set for options $this->setOptions(array( 'elements' => array( 'title' => array( 'type' => 'text', 'options' => array( 'required'...

help in compare validate in c#

i have 2 textboxes that i am filling with StartDate, and Endate. i want to use the compareValidator to make sure that the StartDate is less that the EndDate. i used this: <asp:CompareValidator ID="Comp" ControlToValidate="txtStartDate" ControlToCompare="txtEndDate" Operator="LessThan" Type="Date" runat="server" Display="dynamic" Tex...

How disable RequiredFieldValidator in script

I have TextBox with RequiredFieldValidator on my page. I also have link that calls some simple javascript. <asp:TextBox ID="TextBox1" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox1" Display="Dynamic" /> <asp:LinkButton ID="Link1" runat="server" OnClientClick="DoSo...

JSR-303 dependency injection and Hibernate

Spring 3.0.2, Hibernate 3.5.0, Hibernate-Validator 4.0.2.GA I am trying to inject Spring dependencies into a ConstraintValidator using: @PersistenceContext private EntityManager entityManager; I have configured the application context with: <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFacto...

Zend framework multiple Validators in an array

Hello everybody I want to create a form in Zend framework. I am using the code below for a field: $this->addElement('text', 'username', array( 'label' => 'Username:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array( 'alnum' ) )); This works. But now I also want to add ...

Rails validates_length_of is misbehaving

Hi I have a rails model that I am adding validations to and I seem to have run into a bit of weirdness from one of the validators. So here is the table I am working with (From schema.rb): create_table "clients", :force => true do |t| t.string "name" t.string "last_contact" t.integer "contacting_agent" t.date ...

asp:Validator in invisible elements + invisible targets

Somewhat straightforward: will asp:Validators still perform validation when they're in invisible containers? How about if their ControlToValidate target is invisible? For example: <asp:Panel id="myPanel" runat="server" visible="false"> <asp:Textbox id="myTextbox" runat="server" /> <asp:RequiredFieldValidator id="myRfv" runat="s...

Why "\d+{1,4}(?:[.,]\d{1,4})?" in RegularExpressionValidator throws Exception: "Nested quantifier {"

I have asp:RegularExpressionValidator with ValidationExpression="\d+{1,4}(?:[.,]\d{1,4})?" but it doesn't' work, parser throws ArgumentException: parsing "\d+{1,4}(?:[.,]\d{1,4})?" - Nested quantifier {. Where is my mistake? I want to allow strings like xxxx,xxxx - from 1 to 4 digits and decimal digits are not required, e.g.: 100...

RequiredFieldValidator to validate a disabled textBox

Hi guys, I've got a TextBox in which user can input a their desired username. Underneath I've got a checkbox that once clicked it copies the user's email adress into the textfield and then disable it to prevent further changes. This feature is implemented by using jQuery. The problem is that I've got a RequiredFieldValidator on that Te...

ASP.NET validators alignment issue

Hi, I am developing contactus webpage which have a input field called Email. It is validated against a required field validator and regular expression validator with appropriate messages. Required: Enter Email Regular Expression: Invalid Email I am setting these two as given below: <asp:TextBox ID="txtEmail" runat="server"></asp:Text...