validation

calling custom validation methods in Rails

I just upgraded my rails to 2.3.4 and I noticed this with validations: Lets say I have a simple model Company which has a name. nothing to it. I want to run my own validation: class Company < ActiveRecord::Base validate :something def something false end end saving the model actually works in this case. The same thing h...

Multiple forms on one view in ASP.Net MVC while retaining validation

In a small web app I'm making for internal use, I want the user to be able to select one of the data files to open. I have a strongly typed view which takes the list of files as the model. My initial version had an Index action which got the list of data files and returned the view, then a Create action for creating a new file, and an U...

Validation errors with the form tag

Can someone please tell me why this will not validate strict? <div> <form method="post" action="/search/keywords" /> <input type="text" id="keyword" name="keyword" /> <input type="image" src="/images/go.gif" alt="Search" /> </div> The problem is that I have two <form>s in my page and when I use the "/" to close the for...

Validating html generated by php

Hi, I'm new at web development, so to make sure I'm writing good code I've been using w3.org validation tools. I'm currently working on a project where I generate a lot of my html with php functions, and I'd like to validate the html, but w3.org doesn't support that. The only way I've found to do it is to render my code, view source and...

Listing all Validation.Errors in a single WPF control?

I'm trying to find a simple way of binding a single control (eg. TextBlock or ListBox) to list all the validation errors on a WPF form. Most source code examples I have been able to find just bind a control to (Validation.Errors)[0].ErrorContent which only shows a single validation error. I'm currently using ValidationRule classes, thou...

Doctrine and Zend_Form Validation

I am using Zend Framework and Doctrine on a project and was wondering if anyone can suggest a good way to integrate Doctrine's validation with Zend_Form. I'm trying to avoid code duplication. ...

the most simple javascript form validation question ever

Hi, I have a form with a name and an email address. I want a simple icon to appear to the right of the form if the user types anything in the field, even one character. If there is anything present in the field, I want the success icon to appear. If the user advances to the next field with no input, I want the fail icon to appear. Does a...

How to define elements in a DTD which share the declaration?

How can I define elements in a DTD which share the same declaration? I tried this which leads to a syntax error: <!ELEMENT (expression|condition) (code-text+)> Where expression and condition have the same declaration, that means the same sub-elements and attributes. ...

What validation should I use

I am working on a J2EE web application Here we are using JSP and Struts I know one can use Client side validation (Using JavaScript) Server side validation (Using Validation framework) My question is which way is more proper and one should use in application and why? ...

How can I get validation "ifs" to use parameters (Ruby on Rails)

For conditional validation in Rails, I can do this: mailed_or_faxed_agenda = Proc.new { |me| me[:agenda_mailed_faxed] } validates_presence_of :agenda, :if=>!mailed_or_faxed_agenda but I don't know how to parameterize the Proc. I would love to use if=>blah(name) but I cannot figure out how to it. Any ideas? Note: In these ifs one can ...

Removing ASP.NET validators for controls that are no longer on the page.

I have a page that loads different controls into a placeholder via a ComponentArt Callback based on the user's action (clicking a link). I am running to this scenario: Action 1 loads a control with ASP.NET validators into the placeholder. Action 2 loads a different control with no validators (the first control is replaced and no longe...

Disable Jquery validation

I am using Jquery validation plugin for UI validation. I have a Jquery menu to select the type of transaction. On certain menu selection there should not be any validation happening. I am not sure if there is a way to tell Jquery validation to be disabled I am using a following ways for the validation 1) $.validator.addMethod() 2) $.va...

Validation to allow space for phone numbers

i have a validation in my .net textbox where it will take only numbers but when i put the the phone format like 080 234234 it will not accept because of a space how to resolve this ? could anyone help in regular expression ? Current expression is this [0-9]+ ...

Dynamic Data | LINQ TO SQL | General Validation

I have 5 different entities for which dynamic data(with LINQTOSQL) was generated. On Insert(Insert.aspx) of any of these entities, if there is an error, I would like to notify user that error happened and possibly show some generic error message. 1) I am not talking about regular required field errors but something like "Unique constra...

JQuery Validation - Single rule for multiple fields?

This might be a simple question but I'm just picking this up so please be kind :) Using JQuery validation, if I want a textbox to be a required field I can just add a css class of "required" to the element and it is picked up by the validation. If I want a slightly more complex rule, ie. required with a minimum length, can I use a cust...

Problem setting focus to validationsummary control after validation

Hi, I have a validationsummary control which displays the summary of a few validationrequired controls and all of them belong to a validationgroup. My submit button also has the same validationgroup so it validates everything upon it being clicked. The problem i am having is setting the focus to the validationsummary control after val...

Validating an input based on what is entered in another input - Rails

Hi all, I have a form that has a group of 3 text_fields. I need two of them filled to make calculations. quantity must always be filled. If price is blank, then cost must be filled, or vice versa. I tried this, but price is never nil, even though I leave it blank. I also tried :price == nil and :price.blank?, but they do the same thing...

asp validation off by default

Hey, I'm using asp:requiredfieldvalidator on my page. The usual way of turning this off for a control is to set CausesValidation="false" However I've got more buttons that I don't want to cause validation than I have that do want validation. So my thinking is that it would be easier to turn it off by default and on when I need it b...

jQuery Validator custom method

Hi all, could you take a look at this http://jsbin.com/osolo/ please? If you enter a letter in Min Age rather than a number then hit submit this validates using jquery validator using a regular expression in a custom validation method, this works but i'm now looking to make it a little more dynamic. In the custom validation method...

Validation of Business Logic in Asp.net MVC Using Exceptions

Hi all, I have a question regarding the method i am using for doing Business Rule Validations in asp.net mvc. Currently i have an exception class that looks something like this public class ValidationException : Exception { private ModelStateDictionary State { get; set; } public ValidationException(ModelStateDictionary state)...