validation

Dynamic Range Validation in ASP.NET MVC 2

I am using ASP.NET MVC2 and trying to validate my view models using the attributes in System.ComponentModel.DataAnnotations namespace. How can I dynamically set the permitted valid range of a RangeAttribute? For example, if I want to validate that a date entered is within an expected range. This doesn't compile: [Range(typeof(DateTime...

Add logic to a form when Javascript is disabled

I'd like my form to include a certain value if the quantity is equal to 1 (via a text box). I've managed to show what the total cost is using JavaScript and I could submit it with this value but I'm worried that when JavaScript is turned off the user will be able to submit the form without the extra fee being added. Therefor escaping th...

How can I display an error to the user while they're still editing a DataGridView cell?

If a user enters invalid text in a DataGridView's cell I want to prevent the user from leaving that cell and display an error icon in that cell with an error message in a tooltip. It seems that normally the error icon won't appear until the cell is no longer in edit mode. I found an example of how to get the error icon to appear while ...

Is there anyway to implement XOR in javascript

I'm trying to implement XOR in javascript in the following way: // XOR validation if ((isEmptyString(firstStr) && !isEmptyString(secondStr)) || (!isEmptyString(firstStr) && isEmptyString(secondStr)) { alert(SOME_VALIDATION_MSG); return; } Is there a better way to do this in javascript? Thanks. ...

Javascript to compare two dates, from strings, begin <= end

I get two strings formated like (Brazilian Format): "DD/MM/YYYY", I need to compare both. Since the first field is the begin and the last is the end, My validation is begin <= end Date.new(begin) is generating 'invalid date' even on ISO ! ...

Are there any java libraries for validating user supplied HTML, on the server side?

I have a service which takes the user supplied rich text (can have HTML tags) and saves it into the database. That data gets used by some other application. But sometimes the user supplied data has missing HTML tags and wrong closing tags. I want to validate if the user supplied data is valid HTML or not and depending on that I want to w...

how do I validate form fields in sharepoint list?

I want to validate the fields of the list item while adding/editing and stop the saving operation and provide the error information what the user made on that page itself. For ex, if I want to prevent user not to leave few fields set before saving based on particular status of another field, I cannot make the field as mandatory. ...

Seam Custom Validation

Hi, I'm trying to implement a custom validation annotation in Seam. We have a list of objects, lets call it arrayA, and arrayA is different dependent on today's date. Next we have an input field stringB, stringB is some value in arrayA going through a transformation function funcC(...). So basically, we can validate stringB using th...

Why doesn't validator doesn't like my jquery?

Hi guys, I was just doing some validation and got some errors due to my javascript... Error: document type does not allow element "strong" here $('#myobject').html('<strong>'+multiplier+'</strong><small>&nbsp;objects</small>'); It seems fairly straight forward... i'm putting some html in a html function but w3c doesn't like it... ...

Validate a XDocument against schema without the ValidationEventHandler (for use in a HTTP handler)

Hi everyone, (I am new to Schema validation) Regarding the following method, System.Xml.Schema.Extensions.Validate( ByVal source As System.Xml.Linq.XDocument, ByVal schemas As System.Xml.Schema.XmlSchemaSet, ByVal validationEventHandler As System.Xml.Schema.ValidationEventHandler, ByVal addSchemaInfo As Boolean) I a...

Parent user control validation from child user control ASP.Net

Hi , I have a user control which contains two text fields each assigned with requiredfield validators this control contains another user control contains say a button .On click of this button i need to validate the fields from the parent control text fields. I try the Page.Validate("ValidationGroup") with Page.IsValid it validates but ...

Invalid XML Schema for element with/without sub-elements

Hi I want to write an XML schema which has an element which may contain subelements and/or primitive types. So I have this fragment which does not validate correctly. <xs:complexType name="parameterType" mixed="true"> <xs:complexContent> <xs:restriction base="xsd:anyType"> <xs:any processContents="lax" minOccurs="0"...

Problem validating an XML file using Java with an XSD having an include

Hello! I'm using Java 5 javax.xml.validation.Validator to validate XML file. I've done it for one schema that uses only imports and everything works fine. Now I'm trying to validate with another schema that uses import and one include. The problem I have is that element in the main schema are ignored, the validation says it cannot find ...

How to validate a field only if another has been filled out?

How would I validate a field only if another has been filled out In Ruby on Rails 2.3.5? ...

How to use DataAnnotations ErrorMessageResourceName with custom Resource Solution

I'm building a MVC web application with C#. Since the site will be multilingual, I've implemented my own ResourceManager. This class is responsible for fetching the required resource strings from a database/cache depending on the currents thread culture and works fine so far. My problem is, I'd like to use the my custom ResourceManager...

16-Bits BMP Validation

I'm developing a script using VBScript and I need to validate the input file as a 16-Bits BMP. At the time my script is like this: Const OverwriteExisting = TRUE Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.CopyFile "C:\16bmp.bmp" , "D:\test.bmp", OverwriteExisting But How can I validate the input file as a 16-Bits...

Is it possible to put validations in controllers in Ruby on Rails?

I have an additional member method (and a corresponding route) called download, for which I'd like to validate the existence of a password field. Putting :validates_presence_of :password in my download method, I get an error claiming it's an undefined method. Is this possible? ...

Why doesn't validation in a model referenced by a callback cause my original transaction to fail?

I have a model with an after_create callback. This callback causes a new record to be created in another model. However if a validation fails in the child record creation, the original transaction is still being saved. This doesn't seem right. According to Rails docs the whole thing is wrapped in a transaction. Am I doing something wron...

Grails: Validation of string containing a delimited list of email addresses

I have a Grails command object that contains an emailAddresses field, e.g. public class MyCommand { // Other fields skipped String emailAddresses static constraints = { // Skipped constraints } } The user is required to enter a semicolon-delimited list of email addresses into the form. Using Grails' valid...

Should Business Objects or Entities be Self-Validated?

Validation of Business Objects is a common issue, but there are some solutions to solve that. One of these solutions is to use the standalone NHibernate.Validator framework, which is an attribute-based validation framework. But I'm facing into conceptual concern. Attribute validators like NH.Validator are great but the validation is on...