validation

Is there a varargs null check function in Java or Apache Commons?

I've got four variables and I want to check if any one of them is null. I can do if (null == a || null == b || null == c || null == d) { ... } but what I really want is if (anyNull(a, b, c, d)) { ... } but I don't want to write it myself. Does this function exist in any common Java library? I checked Commons Lang and didn't...

Show asterisk in validation control but show error message in summary.

I'd like a way to both show an asterisk by an invalid field and show a verbose message in a validation summary. However, setting Display to "NONE" in the validation control suppresses any message that would appear next to the field to validate. Is there a way to get this kind of hybrid function? ...

jQuery Validation plugin in ASP.NET Web Forms

I would really like use the jQuery Validation plugin in my ASP.NET Web Forms application (not MVC). I find it easier than adding asp validators everywhere and setting the control to validate field on all of them. I am just having some issues both when setting the class like this class="required email" which I think has something to do...

XHTML Strict Validation.

Really 2 questions. Why is it that these bits of code dont validate to XHTML 1.0 Strict. XHTML 1.0 Strict is a project requirement. Line 2 causes the problem document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag. <for...

What is the best Java email validation method?

What are the good email validation libraries for Java? Are there any alternatives to commons validator? ...

Validating a Unicode Name

In ASCII, validating a name isn't too difficult: just make sure all the characters are alphabetical. But what about in Unicode (utf-8) ? How can I make sure there are no commas or underscores (outside of ASCII scope) in a given string? (ideally in Python) ...

How to validate a Singaporean FIN?

Can anyone provide an algorithm to validate a Singaporean FIN? I know with a Singaporean NRIC I can validate it via modulo 11 and then compare the result to a lookup table but cannot find a similar lookup table for the FIN. I also do not know for sure if the modulo 11 is the correct method to validate. I am aware the government sell...

Disable/enable entire form's submit with jquery

When my form doesn't validate, I want to disable the form's submit function. I can do this by disabling the submit button, but this would leave the enter key unchecked. I can set the .submit(return false); but then I can't re-enable it again later. Any suggestions? ...

Are XML chunks valid?

Hello! I want to store some fragments of an XML file in separate files. It seems, there is no way to do it in a straight way: Reading the chunks fails. I always get the Exception "javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed." It only...

What exception to throw from a property setter?

I have a string property that has a maximum length requirement because the data is linked to a database. What exception should I throw if the caller tries to set a string exceeding this length? For example, this C# code: public string MyProperty { get { return _MyBackingField; } set { if (value.Lengt...

Javascript checking if page is valid

On my submit button, what I'd like to do is OnClick show a "Please wait" panel and hide the button, UNLESS the validators say something's invalid - then I need the buttons still showing obviously. Otherwise I have a validation summary showing erros and no way to submit again. Most articles I find about doing this want to use Page_Clien...

How to disable XML DTD validation in Oracle DB?

Hi I am using following statement in select portion of the query: extract(XMLTYPE(doc.payload),'/SHOW_SHIPMENT_005/DATAAREA/SHOW_SHIPMENT/SHIPMENT/SHIPITEM/DOCUMNTREF/DOCUMENTID') it works well if the doc.payload contains XML without DTD declaration, but raises an error when DTD declaration is present as Oracle tries to validate the d...

ValidatorEnable is not defined when rolled with AJAX

I have some webforms which have been working fine with various static and dynamically generated validators. For some reason now that I have implemented UpdatePanels on the forms, when I manually call the ValidatorEnable() method on one of them (when I click a checkbox) I get the "ValidatorEnable is not defined" error message. I am pass...

PHP form class

I'm used to ASPNET and Django's methods of doing forms: nice object-orientated handlers, where you can specify regexes for validation and do everything in a very simple way. After months living happily without it, I've had to come back to PHP for a project and noticed that everything I used to do with PHP forms (manual output, manual va...

Validating Oracle dates in Python

Our Python CMS stores some date values in a generic "attribute" table's varchar column. Some of these dates are later moved into a table with an actual date column. If the CMS user entered an invalid date, it doesn't get caught until the migration, when the query fails with an "Invalid string date" error. How can I use Python to make ...

Declarative validation of forms in Java/Swing

I use Java for client-side development with Swing. I love Swing; I believe it is one of the better GUI frameworks there. What I miss, however, is the support for declarative validation. Like this snippet from XForms. Do you know any library which allows validating data entry in forms in a declarative way, not by writing ugly validation ...

Model Binding type conversion validation

Currently, I'm seeing when the DefaultModelBinder errors because the input is invalid for the type (character in int, invalid date, etc.) I get UI default error summary “Something has gone wrong…” but no specific error message, regarding the specific property that failed conversion. For example a model property might be a datetime that ...

CSV file validation with Java

I'm reading a file line by line, like this: FileReader myFile = new FileReader(File file); BufferedReader InputFile = new BufferedReader(myFile); // Read the first line String currentRecord = InputFile.readLine(); while(currentRecord != null) { currentRecord = InputFile.readLine(); } But if other types of files are upload...

ASP.NET MVC - Custom validation message for value types

When I use UpdateModel or TryUpdateModel, the MVC framework is smart enough to know if you are trying to pass in a null into a value type (e.g. the user forgets to fill out the required Birth Day field) . Unfortunately, I don't know how to override the default message, "A value is required." in the summary into something more meaningful...

ASP.Net MVC datarow validation

I am delevelopring my first MVC application and I am using a classic ADO.NET dataset as a model. The guide I am following is the NerdDinner ASP.NET MVC Tutorial and it mentions a GetRuleViolations() method for a Linq To SQL model. I would like to have a similar method to check that a datarow is valid after editing. How could I do such a ...