custom-validators

Zend Framework: is there a way to access the element name from within a custom validator?

I'm writing a custom validator that will validate against multiple other form element values. In my form, I call my custom validator like this: $textFieldOne = new Zend_Form_Element_Text('textFieldOne'); $textFieldOne->setAllowEmpty(false) ->addValidator('OnlyOneHasValue', false, array(array('textFieldTwo', 'textFieldThree'...

How do I hook up javascript to my CustomValidator control in .Net

I have created a CustomValidator control public class MyValidator :CustomValidator, IScriptControl {} and also created the equivalent client script. The server validation works fine, however how do I hook up my client script? The rendered javascript looks like var MyValidator1 = document.all ? document.all["MyValidator1"] : documen...

How can I make a custom validator fire even if a textbox is empty?

I set a custom validator on a textbox. It only validates if there is some text in the textbox, I need it to fire all the time when someone clicks on the submit button. How can I do this? ...

Zend Db_NoRecordExists - checking against multiple columns

Hi, Zend Db_NoRecordExists docs seem to be limited to checking only one column. Is there a way to check multiple keys when validating an entry? For example, I am allowing the same email address for different cities. here's my current validator: $email->setValidators(array(array('emailAddress'), array('Db_NoRecordExis...

ASP.NET validator to compare two date difference is not more than 12 months

I have two TextBox controls for start date & end date input. I have to validate that end date is not greater than start date & the difference between start date & end date is not more than 12 months. ...

How to make ASP.Net custom validators produce an alert

Hi, All ASP.Net client validation messages can be shown as an alert by setting the ShowMessageBox="True" property on the ValidationSummary control. This works fine for anything that happens on the client. For the custom validators that validate server-side I had assumed that what would happen is that when the page is returned to the b...

Custom Validation with MVC2 and EF4

Hi, on ScottGu's Blog is an Example how to use MVC2 Custom Validation with EF4: http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx So here the Problem: When the Designer in VS2010 creates the Objects for the DB, along to the example you have to add [MetadataType(typeof(Person_validation))] Annotation ...

Custom Validation Attribute with Custom Model Binder in MVC 2

I apologise for the amount of code I have included. I've tried to keep it to a minimum. I'm trying to have a Custom Validator Attribute on my model as well as a Custom Model binder. The Attribute and the Binder work great seperately but if I have both, then the Validation Attribute no longer works. Here is my code snipped for readabi...

Developing a custom-validation in asp.net for specific control and criteria

Hello There is another relevant question asked Validation Check in asp.net In the same scenario we need a custom validator control which will alert user for any wrong entry. This will work like this : Developer will pass the control-name, input-value and format-required For instance like for textbox it can be: txtName,txtName.Text, a...

symfony : Problem with custom post validator

Hello, I have made a nested form using the method 'embedRelation'. In a main form I have twelve child forms. EDIT : $subForm = new sfForm(); for ($i = 0; $i < 12; $i++){ $enfant = new Enfant(); $enfant->Locataire = $this->getObject(); $form = new EnfantForm($enfant); $subForm->embedForm($i, $form); } $this->embedForm('n...

MVC 2, custom data annotation validation rules with jquery.validate and a validation summary

I am using a validation summary and client side validation as written about here. My problem was then that I wanted a client side validation that supported comparing the equality of 2 fields : email address and password with confirms for both. So, following Soe Tun, I was able to get my data annotations to automatically run client side...