2
голосов
2ответов
1468 просмотров

Validate a Collection Has at Least One Item using Validation Application Block

Using the Enterprise Library 4.1 Validation Application Block, how can I validate that a collection property contains at least one item?

104
голосов
10ответов
154930 просмотров

Validating URL in Java

I wanted to know if there is any standard APIs in Java to validate a given URL? I want to check both if the URL string is right i.e. the given protocol is valid and then to check if a connection can be established. I tried using HttpURLConnection, providing the URL and connecting to it. The fir...

5
голосов
6ответов
19364 просмотров

How to validate sql query syntax?

java 1.4 Sql server 2000 i am taking input of sql query (for validation of field value against values retrieved by executing sql query) from admin user which will be stored in database and later i will executing sql query corresponding to field.Before inserting sql query in database i want to va...

4
голосов
5ответов
11340 просмотров

<embed> tag in HTML not supported</embed>

I get the following warning in a ASP.NET project using the &lt;embed&gt; tag to put a .swf: Warning: Validation (XHTML 1.0 Transitional): Element 'embed' is not supported. What is the "supported" way to do it instead???

3
голосов
1ответов
1379 просмотров

Problem with ASP.NET Custom Validator for a Comma Separated List of Email Addresses

I followed a blog post here to use a custom validator to validate a list of emails. However, the Regex expression in the article: Regex emailRegEx = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.IgnoreCase); allows this email address through: "...

32
голосов
5ответов
14357 просмотров

Refactoring Guard Clauses

What approaches do people take (if any) in managing guard clause explosion in your classes? For example: public void SomeMethod&lt;T&gt;(string var1, IEnumerable&lt;T&gt; items, int count) { if (string.IsNullOrEmpty(var1)) { throw new ArgumentNullException("var1"); } if ...

4
голосов
2ответов
1704 просмотров

Is validates_presence_of necessary if using validates_length_of?

In an ActiveRecord model is it considered best practice/necessary to use validates_presence_of when also using validates_length_of? For example: class Company &lt; ActiveRecord::Base validates_presence_of :name validates_length_of :name, :in =&gt; 5..30 end To me, it seems redundant. Ha...

0
голосов
2ответов
1343 просмотров

Rails Validation | add class to surrounding <div></div>

Rails question. The default behavior for error validation is to fieldWithError-styled div around the input field like the following &lt;div class="type-text" id="pre_negotiation_value_div"&gt; &lt;label for="contract_budget_holder"&gt;Budget Holder&lt;/label&gt; &lt;div class="fieldWithErrors"&...

0
голосов
1ответов
68 просмотров

writing an attribute to my through table with validation?

I have been trying to do this for ages and can seem to grasp it. hope someone can help ? i have a 'message' model that has many through 'distribute' relationship to a 'contact_detail' model. basically a message can have many contacts associated with it and a contact can have many messages. I ...

5
голосов
1ответов
3276 просмотров

Validating length of habtm association without saving

I have a user model with a HABTM relationship to groups. I do not want a user to be able to be in more than 5 groups, so would like to validate the length of the HABTM relationship. On the edit user page I have a list of checkboxes where the user can select the groups they want to be in (I'm us...

0
голосов
1ответов
2142 просмотров

ASP.Net AJAX ValidatorCalloutExtender issue

I am building a User Control (requirement – has to be User Control). This user control is inside an AJAX Update Panel on the parent page. The user control has two Infragistics Web Date Chooser controls on it. Both dates are required. I have placed asp.net RequiredFieldValicators on both contr...

3
голосов
2ответов
8624 просмотров

Validate request headers with Spring validation framework

Is it possible to use the Spring validation framework with Spring MVC to validate the presence and value of an HTTP request header?

0
голосов
1ответов
512 просмотров

Using Client-Side script to evaluate month difference using PeterBlum DifferenceValidator

Problem: I am using Peter Blum's Professional validation controls (http://www.peterblum.com/DES/MoreValidators.aspx) throughout my project and have come across a validation that should be done on the client side rather than going back to the server. The screen needs to send two dates(month/y...

0
голосов
3ответов
1014 просмотров

Simple textbox validation - display message is nothing is entered

I'm pretty new to this so here goes... I'm using Visual Studio 05 (C#) and in my program I have a textbox and a submit button. The user enters an email address and results are then displayed from the database (this works) using an ASP gridview control. What I am after is a simple piece of valid...

5
голосов
7ответов
2111 просмотров

asp.net mvc different validation rules for different actions

What is the best practice for validating my model for different actions, for example, different validation rules for creating and deleting? Thanks! Clarification: I think this needs some clarification because the answers don't seem to be addressing the question. For example, Create Person V...

4
голосов
3ответов
671 просмотров

Is ASCII "../" the only byte sequence that indicates a directory traversal in PHP?

I have a PHP app that uses a $_GET parameter to select JS/CSS files on the filesystem. If I deny all requests in which the input string contains ./, \ or a byte outside the visible 7-bit ASCII range, is this sufficient to prevent parent directory traversals when the path is passed to PHP's under...

9
голосов
1ответов
10309 просмотров

Ajax.BeginForm - Displaying Validation Errors

Using the MVC project template in VS2008 (out of the box) I noticed the following: Here is how the Register.aspx form is specified. &lt;% using (Html.BeginForm()) { %&gt; Selecting the Register button without supplying any account info shows this. Account creation was unsuccessful. Pleas...

1
голосов
2ответов
124 просмотров

Best practices to deal with absent/wrongly typed GET variables?

What do you do when you detect your get request is broken or is passing wrong types of data? Say you have a forum-page.php?forum=3 that lists all the topics related to forum 3. What would be a good way to deal with the absence of the "forum" variable? What about if instead of being an integer, y...

16
голосов
17ответов
11745 просмотров

"Date of birth" validation: How far/much would you go?

I'm quite anal about form validation. So while creating a validator for a "data of birth" (DOB) field in one of my current projects for a job application form (platform/language is neutral in this context), I wanted something to prevent 'punky' inputs. I used a date picker and restricted the max...

2
голосов
3ответов
459 просмотров

A very basic question about the way GUI integrated with the Logic classes

assume i have a huge input form, which of course representing classes. i need this input to be loaded into the class's instances. this input obviously contains (some very complicated validation) checks, obviously the logic layer contains those input validation already. the question is what am i d...

9
голосов
2ответов
4564 просмотров

How does validation in ASP.NET MVC 2 actually work?

I am trying to trace through why my ASP.NET MVC 2 validation isn't working, but I cant find enough about HOW it works to be able to do this. I have followed the steps in this useful article by David Hayden which seems to be the best documentation currently out there, but nothing actually happens...

13
голосов
4ответов
17230 просмотров

Validate that a file is a picture in PHP

If a file is uploaded to the server, is there a way using PHP, to make sure that it's actually a picture and not just a file with a .jpg or .gif extension?

0
голосов
6ответов
2491 просмотров

How to point to CSS default class using the class attribute

Is there a way to point to the default CSS class of an object? For example, depending if a user is logged in I want to specify a different CSS class to control the style of a header. $css_class = ""; if($logged_in) $css_class = "success" echo "[h1 class=".$css_class."] My Title [/h1]" I...

4
голосов
4ответов
3495 просмотров

Disable SQLCMD Syntax Check

We sometimes write dataport scripts that rename tables or columns and have other complex logic. We also have SQL in IF statements referencing those old columns or tables. We have a standard to use IF statements to make our SQL Scripts multi run friendly. However occasionally, even though the i...

3
голосов
3ответов
4536 просмотров

ASP.NET: Validate file size (width and height) before upload

Is there some way to validate the image size (height and width) before upload it to server? I think is using Javascript but I don't know how. Or maybe with some client asp.net validator. Any advice?

1
голосов
4ответов
4616 просмотров

Cannot validate against multiple xsd schemas in C#

I wanna verify a digitally signed xml against its schema definition while this schema actually contains this tag &lt;xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd" id="schema"/&gt; Then I tried to load schemas: XmlReaderSettings settings = ne...

0
голосов
1ответов
1655 просмотров

Utf "\x94" validation error in html/xhtml form for php

Okay XHTML want's to play some games with me, I was doing fine, until up to now. Looking at the two code snippets below I don't see anything wrong with them, however when I try to validate I get "The error was: utf8 "\x94" does not map to Unicode on line 91, I have commented line 91 to denote ...

0
голосов
2ответов
264 просмотров

Duplicated Zend_Form Element ID in a page with various forms

How do I tell the Zend_Form that I want an element (and it's ID-label, etc) to use another ID value instead of the element's name? I have several forms in a page. Some of them have repeated names. So as Zend_Form creates elements' IDs using names I end up with multiple elements with the same ID,...

1
голосов
2ответов
463 просмотров

How do I validate a Django form containing a file on App Engine with google-app-engine-django?

I have a model and form like so: class Image(BaseModel): original = db.BlobProperty() class ImageForm(ModelForm): class Meta: model = Image I do the following in my view: form = ImageForm(request.POST, request.FILES, instance=image) if form.is_valid(): And I get: AttributeError...

0
голосов
2ответов
296 просмотров

hide part of form

I have an asp.net mvc application where I want to hide/display part of form based on selected line in a dropdown list. This is done by jQuery script: &lt;script type="text/javascript" &gt; $(document).ready(function() { $('#owners').change(function() { $("select option:se...