validation

ASP.NET MVC 2 Validate Nested Objects

According to the spec, complex child properties (aka "nested objects") are validated only if an input is found for one of the nested object's properties. For example, if Person has properties { string Name, Address HomeAddress } and Address has properties { Street, City }, and an action accepts parameter of type Person, then Person.Home...

When implementing a DataAnnotations validation attribute, should I call base.IsValid()?

I'm creating a DataAnnotations validation attribute for matching emails using the same pattern as jQuery (yes, it must have been done before, but I can't find it...) and I'm not sure on exactly what I'm supposed to override and whether methods on the base classes should be called or not. Currently I have this implemnetation: public clas...

how to build errors like that shown in Androffice screenshots

Anyone knows how to build errors like that shown in Androffice screenshots on AppBrain (http://www.appbrain.com/app/android.androffice)? I think that I saw errors like that before. Is that built in Android SDK? ...

MVC Validation using Data Annotations - Model classes or View Model classes?

Is it best practice to put data validation annotations in the Model or View Model? What are the advantages/disadvantages of one approach over the other? Curious to see where everyone is putting their validation, I am currently doing it in the model project. However I have seen a few people say this is not best practice. ...

How do I implement ASP.NET MVC 2 validation that checks the database?

All examples that I can find do something like this: [Required] public string Title { get; set; } That's great for simple cases, but what about something that checks the database or something else server side? For example, say I have a movie database and I want to allow people to rate it. How could I tell if someone has already rated...

ActiveRecord - replace model validation error with warning

Hi, I want to be able to replace a field error with a warning when saving/updating a model in rails. Basically I want to just write a wrapper around the validation methods that'll generate the error, save the model and perhaps be available in a warnings hash (which works just like the errors hash): class Person < ActiveRecord::Base #...

What's wrong with this javascript function?

I am using the following javascript regex email validate function but it doen't seem to work why.... function IsValidEmail(email) { var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; return filter.test(email); } function forgetpassword() { if (document.getEle...

non-generated forms in mvc

I still don't understand how I should handle my form input errors within an mvc. I have f.e. the a zend-like controller and a form class and so on. But where do i include my form file which is not generated but only with pure html <html> <title>User-Registration</title> <head>...</head> <body> <?php (if($errors)) { ?> <p ...

Django: construct form without validating fields?

Hi, I have a form MyForm which I update using ajax as the user fills it out. I have a view method which updates the form by constructing a MyForm from request.POST and feeding it back. def update_form(request): if request.method == 'POST': dict = {} dict['form'] = MyForm(request.POST).as_p() return HttpResp...

Rails 2 Trailing Route Parameter

I'm building an article/blog website where any article may show up within a series of URL paths. /section/article /section/page/article /section/page/page2/article This works, but what if I wanted to have the page number for that article (/page/123) be bound to those URLs /section/article/page/123/ /section/page/article/page/123 /sec...

XML signature validation against remote certificate, with PHP

I'm working on a project where I need to validate an embedded signature in an XML file (SAML assertion) against a public key located on a remove server. Has anyone done this in PHP? ...

Error while trying to validate XML in Java

I'm trying to validate one xml that I create with a local schema, but some freak error is throwing. My code: SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); factory.setS...

spring 3 | show binding errors next to each input

Hi @all! My first question as a spring newbie: How do I show validation errors NEXT to each input/component? Validator: @Override public void validate( final Object obj, final Errors e ) { ValidationUtils.rejectIfEmpty( e, "firstname", "error.firstname.empty" ); } JSP: <form:label path="firstname"> <spring:message code="labe...

Cocoa input validation for duplicate name how?

How can I implement this validation in Cocoa? My Situation is: Model: An object names Person, with a name property. And an NSArray of Person objects, View: NSTableView, it uses data-binding to bind with the Person object array. The NSTableView has in-place editing function enabled. When user finish editing the name in NSTableView, I ...

Need validation for a form in PHP not in Javascript?

Hai.. i already added javascript validation for my form.Its working fine.But mean while i ve to validate the same form using PHP also. This is the form code: class airportclass{ function add_airport_frm(){ $errmsg=0; <table> <form action="" method="post" name="airport" > <tr> <td colspan="2" align="center"><?php echo $err...

Why this feed doesn't validate

http://feedvalidator.org/check.cgi?url=http%3A%2F%2Ffeeds.feedburner.com%2FVideoRicette it tells me that there's an invalid character but I can't find it ...

Validating input with jQuery autocomplete plugin

I'm using the standard autocomplete plugin here. I have two text boxes on my form, item name and item id. The idea is that I want the user to search for the item by name, but on form submit I actually need the item id. I am returning json from an ASP.NET MVC action which is used in the autocomplete. The user starts typing an item name...

Validating arguments to a method

Hello, I have a question on the best practice for validating arguments to a method when the arguments are contained within an object. For example, if you have: public class Student { public int getStudentId(); public String getStudentName(); public String getStudentSSN(); public double getStudentGpa(); public String...

Validate string is base64 format using RegEx?

Hi, I have been looking how to validate a base64 string and came across this. ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ I need a little help to make it allow "==" aswell as "=". Thanks ...

Where can I find a decent tutorial/explanation of using Castle Validators with ASP.NET MVC2?

Where can I find a decent tutorial/explanation of using Castle Validators with ASP.NET MVC2? I want to go with Castle because I'm not fond of the fact that I can't test my POCOs using Data Annotations without copying the logic of grabbing the attributes and calling isValid on all of them. I'm much more fond of the fact that with Castle ...