validation

Is it better to use exceptions in a "validation" class or return status codes?

Suppose I'm creating a class to validate a number, like "Social Security" in US (just as an example of a country-based id). There are some rules to validate this number that comes from an input in a html form in a website. I thinking about creating a simple class in Python, and a public validate method. This validate returns True or Fal...

On focus JavaScript Error

I have a dojo dropdown list widget here is the code: dojo.forEach( dojo.query(".select-frame-inner-border ",_this._container), function(obj){ evt = dojo.connect(obj,"onmouseenter",function(){ if (_this._disabled){return;} _this.hasManualFocus = true; **_this.ob...

Using core validation within custom validation on CakePHP Forms/Models?

Using CakePHP 1.3 I understand the example at http://book.cakephp.org/complete/1143/Data-Validation#Adding-your-own-Validation-Methods-1181 on how to add my own validation methods, but maybe I'm missing something. I only want to validate that Field_B is 'numeric' (a core validation) if Field_A (a select/option) is equal to a certain...

zend_form set fields required only if checkbox is checked

I'm using Zend_Form with a registration page. I have a checkbox, that if checked, will show additional billing fields. In my form instance, I only want those extra fields to be setRequired(true) if that checkbox is checked. Is there a way to do this? The problem now is I have to set all the billing fields as setRequired(false), but if th...

cakephp registration form not verifying fields

My registration form is not checking all the fields and is calling login and saying that I registered successfully. Also, if both passwords are blank, it still "registers" heres my User model <?php class User extends AppModel { var $name = 'User'; var $validate = array( 'username' => array( 'rule' => 'notEm...

C# - Multiple Text Box Non-Zero Length Validation Efficiency

Hi all, I've got six text boxes, and as long as one has valid input in it I want my program to go ahead with import code. Problem is I don't know what the most efficient way to do it is. The two alternatives I've come up with thus far are as follows: Version 1: //if no paths are specified the user is shown an error and the prog...

Validating Uri from String

Hi everyone, I need an Uri validation method. So, strings like: "http://www.google.com", "www.google.com", "google.com" ..must be validated as Uri's. And also normal strings like "google" must not be validated as Uri's. To do this checking, I use two methods: UriBuilder and Uri.TryCreate(). The problem with UriBuilder is that any s...

MVC2 model validation mutually exclusive required annotation

Does anybody know of a good algorithm to mutually exclusively check two properties using a ModelValidator? Something like: [EitherPropertyRequired("BuildingNumber","BuildingName"] public class Address{ public int BuildingNumber { get; set; } public string BuildingName { get; set; } } ...

JQuery Validate individual fieldsets

Hi, I've developed a form with multiple fieldsets to represent steps in filling out the complete form. The fieldsets are shown and hidden by button click (one on each fieldset) but I want to validate each fieldset before the next is shown. I'm new to JQuery and I'm having a bit of trouble. I found this guide ( http://encosia.com/2009...

Validating an XDocument instance against its own schema reference.

I'm using the XDocument.Validate extension method to validate my instance. Is there anyway to hold an XML instance accountable to its own schema reference? This seems like something that would be fairly implicit. Unfortunately simply loading the instance into an XDocument doesn't seem to perform this validation implicitly. ...

nested form - how to validate parent model based on inputs on child model?

Hi all, Have a nested form, the relationship is like so class Inspection < ActiveRecord::Base has_many :inspection_components accepts_nested_attributes_for :inspection_components class InspectionComponent < ActiveRecord::Base belongs_to :inspection I have a custom validate method in Inspection which depends on attributes enter...

How do I rewrite this HTML to validate to XHTML 1.0 Strict?

How do I rewrite this HTML to validate to XHTML 1.0 Strict? <div> <a href="link.html"> <p>Some text</p> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> </a> </div> My intent is to have the entire div serve as a clickable link. The content within simply describes th...

annotation-based validation framework

Hi, I'm looking for an annotation-based validation framework, that would allow me to validate parameter values. Something like the following: void someMethod(@NotBlank String foo, @NotEmpty Collection bar, @Positive Integer baz, @NotNull Object obj) { } Validation of the parameters should happen automatically whenever an annotated m...

drupal multiple view arguments with PHP code validation for empty arguments

I have a view set up to accept 2 arguments. The url is like this: playlists/video5/%/%/rss.xml It works fine if I supply the url with 2 arguments like playlists/video5/front/coach/rss.xml. I have 2 arguments of "Taxonomy: Term" But I need it to run even if 1 or no arguments are supplied. It looks like you can do this with PHP Code under...

Does validation still need the binding?

In Net 3.5 to set a validation rule in WPF you had to set binding as well. Is it still true for Net 4.0? If yes, is there any easy workaround for that? I.e. setting validation without setting binding. I am asking because adding regular binded value is an overkill for me (in this particular case) -- I just show a dialog, if user clicked...

Metadatatypes with self-validation using validation application block

Is it possible to use the selfvalidation attribute with my validations located in a metadatatype? I'm using Enterprise Library 5's Validation Application Block. ...

jquery Validate Plugin Partial Form Validation in OnClick Function

My problem is very similar to this post: Validate subset of form using jQuery Validate Pugin, but couldn't get anything to work. I'm trying to use the jquery validation plugin to do partial form validation in an onclick js function. I have a view that has a form with many divs, each div represents a page like so: <form method="post" n...

Java Problems - Scanner Input and If (X == Input) Statements

I just read through seven threads related to Java Scanner issues, but none contained the answer to my problem. I'm trying to get user input form the console. I create a Scanner object (input) then try to store the user's command in a string called "command." Then I pass "command" back to the original runGame function. It seems that Scan...

magento validation related problem

hello all! can any one tell me where or in which file(path of that file I need to make change for edit validation class like input-text required-entry in magneto.. I required this because-> this validation is not working if there is default value in text box where this class is applied.. like .. in my form name filed name has two text...

Howto write custom checks/validation for the play-framework

I try to write checks for the play-framework and see two different possibilities. I described both and want to know if my understanding is correct (So it's more a tutorial than a question, specially because I didn't get any response that I missed something). So what possibilities exists. The simple way: Extending the class Check: Advan...