validation

Tool to correct invalid CSV files

Is there any command-line tool or ruby library to clean/correct invalid .csv files, something like tidy for html? Example of error: unescaped non-successive double quotes. Related to: Regular expression to find and replace unescaped Non-successive double quotes in CSV file. ...

CakePHP Form Validation Error Placement

Is there any way to change the placement of form validation messages in CakePHP? For instance, I have the following: In the view: echo $form->input('fname', array('before' => '<li>', 'label' => 'First Name', 'after' => '</li>')); In the controller: 'fname' => array('rule' => 'notEmpty', 'message' => 'Please enter your first name.'),...

How and when to apply business rules?

Hi, Suppose I have a service StateService which has a method ChangeState. ChangeState(State toState, DomainObject object) I have business rules that checks whether the destination state is valid or not in the domain objects current "state", how can I technically check those rules without first setting the toState on the domain object...

How to extending Jquery validatation to validate 2 of 3 required phone number?

Hello, I am using jQuery Validation and here is the extension that I am using to validate US phone number. jQuery.validator.addMethod("phoneUS", function(phone_number, element) { phone_number = phone_number.replace(/\s+/g, ""); return this.optional(element) || phone_number.length > 9 && phone_number.match(/...

Form Validation Messages in ASP.NET MVC2 - using images instead of text for error messages

OK - at the moment, to validate my pages I am using [Required] in my model in an MVC2 C# project. For eg in my model I have: [DisplayName("Username")] [Required(ErrorMessage = "Please enter a Username")] public string UserName { get; set; } ... and in my view I have <%=Html.ValidationMessageFor(x => x.UserName, "*")%> But then th...

Asp.Net custom validator: how to get the 'controlToValidate' property on ClientValidationFunction?

Hi everybody Lets say I have this code. <asp:TextBox ID="TextBox1" runat="server" /> <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidationFunction1" ControlToValidate="TextBox1" Display="Dynamic" /> And a validationFunction: function ValidationFunction1(sender, args) { } And i ...

How would I make a Zend_Form_Element_Hidden tag immutable?

I have a value that needs to be set in the form for processing, but I do not want the user to be able to edit this value. A hidden element will mostly fit my needs, but I'm concerned a clever user could enable the hidden field and change it. Is there a validator or setting on the Hidden element that would require the submitted form valu...

Silverlight 4: Localization of built-in data annotation validation exceptions

I would like use data annotations to handle validation in my Silverlight app. The built-in validation attributes (primarily StringLength and Required) are great, and make life very easy. However, they seem to have one critical flaw. If my locale is set to fr-CA, for example, the validation exceptions are still in English - 'The Name fiel...

Validating user input?

Hi, I am very confused over something and was wondering if someone could explain. In PHP i validate user input so htmlentitiies, mysql_real_escape_string is used before inserting into database, not on everything as i do prefer to use regular expressions when i can although i find them hard to work with. Now obviously i will use mysql_r...

How to create a central PHP input validation file and use it?

Hi, I have some basic validation of some variables, but it is repeated on more than one page, how can I create a validation file and call it when needed? Here is some code: $rep = ''; $clean_rep = ''; $rep = $_GET[rep]; //Basic Variable Validation switch ($rep){ case 'All': case 'Ian': case 'Mike': case 'Stan': case...

How can I add validation error tooltips in an ActivityDesigner?

I can't seem to get it working at all. The ModelItem has a couple attached properties on it, ValidationState and ValidationError. I'd like to watch the ValidationState and, if Error or whatever, display the error in the tooltip for the control. Here's as close as I've come so far: <TextBox x:Name="expression" Text="{Binding M...

Is it possible to have too many validations?

Does the number of validation ClassMethods have anything to do with the performance of an application? Could a boatload of validations cause a strain? ...

ASP.Net MVC Validation via DataAnnotations

I followed scottgu's blog here and tried to do data validation. Succeeded. However what I see is that if my field is a required field, i get an error as soon as i loose focus from my textbox. I want validation to happen only when I click submit. ...

spring mvc annotation validation

I have a form that looks like this public class ValidationForm { private Person person; @Size(min=1,max=10,message="out of range") private String test; //other stuff My validation controller is like this public void processForm(@Valid @ModelAttribute("validateForm") ValidationForm vform, BindingResult result){ My Person ...

How to handle exceptions on Doctrine 2 validation

I'm new to Doctrine 2 (and exceptions in PHP, really), but am trying to come up with a robust validation engine on Doctrine 2 (on top of CodeIgniter), following this page. Right now I'm wondering where I would define the ValidateException class, and how to 'try' doing a save (persist?) on my entity (from a controller, library, etc). I'...

Filtering user input - clarification needed

I would like to clarify what is the proper way to filter user input with php. For example I have a web form that a user enters information into. When submitted the data from the form will be entered into a database. My understanding is you don't want to sanitize the data going into the database, except for escaping it such as mysql_esca...

Input validation in textbox in windows phone 7

I am new to windows phone 7 development platform.I am trying to do validation for textbox input. On debugging ,in case of invalid input , I get the error "exception was unhandled".How to correct this?This code works fine for silverlight application. TextBox Text="{Binding Name, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExcep...

Some help with an RSS feed

I need some help with an RSS feed I'm working on. This is the code of an item: <item> <title>Team Fortress 2</title> <link>http://wormgineers.com/index.php?page=File&amp;id=228&lt;/link&gt; <description><[CDATA[Map with characters from Team Fortress 2.]]></description> <guid>228</g...

In NetBeans, how do you use a "catalog" schema file?

I recently started using NetBeans, and I can already see some advantages vs. Eclipse (like, for instance, NetBeans has a XUL plug-in for developing Firefox extensions; Eclipse doesn't). However, I've run in to an issue with the XML plug-in, specifically the auto-completion/validation by schema file part. I've searched the web, and the ...

Where/when should i validate my data when using EF and POCOs?

I started a project to see what EF 4 can do with POCOs. I created a db and a custom POCO. Now i want to validate my data. For this i'm using the Enterprise Library Validation Block 5. I have no problem including the validation in my POCOs through attributes and using it with Entity Framework but this means that my POCOs wouldn't be POCO...