validation

PHP File Validation using If statements uploads.

Hi I am quite new to php but i have been following some tutorials but they don't seem to work so I have tried to adapt them. I have tested this code and it works to a point but theres something else I can't get my head around, the php file is not uploading (fine) but the details are still being writen to the datbase although the $ok is...

Getting column length from Hibernate mappings?

To validate data I am receiving I need to make sure that the length is not going to exceeded a database column length. Now all the length information is stored in the Hibernate mapping files, is there anyway to access this information programmatically? ...

Javascript check box validation and length

Have check boxes 1-300. This JS function alerts user when nothing is selected. Function works great for the first 290 elements. For example, when item 291 is selected it alerts that nothing is selected. document.checks.user.length is coming out to 298, not sure why that is either. Any suggestions? Thanks. function sub_delete() //Submit ...

Is there a case where parameter validation may be considered redundant?

The first thing I do in a public method is to validate every single parameter before they get any chance to get used, passed around or referenced, and then throw an exception if any of them violate the contract. I've found this to be a very good practice as it lets you catch the offender the moment the infraction is committed but then, q...

Validating part of the model in MVC

I am trying to wrap my head around doing validation in a MVC scenario. I have my application setup so that it has a Data/Repository layer that uses Linq2SQL and creates objects in my domain model. I don't expose my Linq2SQL objects directly to the rest of my app however, for now, my domain model mostly looks like my database tables. I wa...

What is the best way to handle domain-centric validation while providing a rich UI experience?

My company is developing a GUI application that allows users to query a legacy database system and have the results displayed back to them on the screen (the results just come back in a blob of plain-text). I'm struggling with the best way to structure the interaction between the user interface and the domain layer, especially validation...

What would you use for a business validation layer?

In my project I need to create a business object validation layer that will take my object and run it against a set of rules and return either pass or fail and it's list of failure reasons. I know there are quite a few options out there for accomplishing this. From Microsoft: Enterprise Library Validation Application Block Windows Wor...

How to change the template for the ValidationSummary

In ASP MVC (RC 1), how can I change the default template for ValidationSummary? By default it ValidationSummary() shows a bullet list of errors in red. How can I change this? (i.e Have images instead of bullets) ...

Deserialization validation

I'm working with a list of fonts that I serialize and deserialize using DataContractSerializer. In between the two steps, it's conceivable that the user has removed a font from their machine. I'd like to check a font name as it's being deserialized to ensure that it still exists on the system. If it doesn't exist, that element is not inc...

ASP Form problem

Hi I have an asp form that has a checkbox and dropdown menu. If the checkbox in not selected then I need to make sure the dropdown is either not selected or disabled. ...

What is the format accepted by System.Net.Mail.MailAddress' parser?

I'm working on an app that's using System.Net.Mail.MailAddress and friends for sending emails. Does that parser implement the full RFC5322 or a subset or what? The MSDN is not very forthcoming on this topic. Any hints appreciated. ...

How do you use Castle Validator with Subsonic generated classes?

Castle Validator uses attributes to specify validation rules. How can you hook these up with Subsonic's generated classes (or any classes where you can't define the attributes on)? Is there a way to programatically specify validation rules without using the attribute method? ...

How do you deal with strings that have structure?

Suppose I have an object representing a person, with getter and setter methods for the person's email address. The setter method definition might look something like this: setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } Calling person.setEmailAddress(0), then, would generate a type error, but cal...

WPF - List View Row Index and Validation

Hi, I have a ListView with TextBoxes in second column. I want to validate that my text box does not contain a number if the third column(data_type) is "Text". I am unable to do the validation. I tried a few approaches. In one approach I try to handle the MouseDown event and am trying to get the Row number so that I can get the data_typ...

Validating Date Parameter in SQL Server Stored Procedure

I've written a stored procedure that takes in a date parameter. My concern is that there will be confusion between American and British date formats. What is the best way to ensure that there is no ambiguity between dates such as 02/12/2008. One possibility would be for users to enter a date in a format such as 20081202 (yyyymmdd). Is th...

RegularExpressionValidator Expression needed

Hi all, i am using asp.net 3.5 and VB.net, i need a validation expression to validate a string of 1 to 50 characters, white spaces, numbers, special character are all allowed, simply, it should match an nvarchar(50) database field. it will be applied to a textbox, also, the same case but for 1-200 characters which will be validating a mu...

xsd schema validation

Hi all, I am having an issue with xsd schema. I have a following schema defined: <xs:element name="nodes" type="nodesRootType" /> <xs:complexType name="nodesRootType"> <xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:element name="node" type="nodeType" /> </xs:sequence> </xs:complexType> <xs:complexType name="nodeTy...

Validation of a validation expression

...

How to make not-null varchar columns to be required to be not empty in ASP.NET MVC validation?

So I'm using ASP.NET MVC RC1 and using the DefaultModelBinder's validation to show validation errors when not-null integer fields are not set to a value. This is done by default by MVC. However the same is not true for string(varchar) fields, because the binder is passed an empty string from the view, which is completely valid for a no...

Setting RegularExpressionValidator ValidationExpression in JavaScript

Is it possible to set the ValidationExpression of a RegularExpressionValidator using JavaScript? I'm using ASP.NET 3.5. Here's why I want to do this... On a payment page I have a DropDownList that allows my user to select their card type. Beneath that is a TextBox in which they type their card number. I want to use a RegularExpression...