validation

How to sanity check a date in java

I find it curious that the most obvious way to create Date objects in Java has been deprecated and appears to have been "substituted" with not so obvious to use lenient calendar. So... How do you check that a date given as a combination of day, month and year is a valid date? For instance a date 2008-02-31 (as in yyyy-mm-dd) would be in...

What are validation options for ASP.NET MVC

Hi, What are my validation options with .net mvc? Do any of them have a nice validation summary like webforms did? ...

How to implement BaseValidator and IValidator in custom control - ASP.Net

I have a custom control that inherits from WebControl and implements IValidator, but I also want to have a property for ValidationGroup. From research, it appears I need to inherit from BaseValidator to do so. Can anybody provide a successfull example from a ASP.Net custom control that implements both BaseValidator and IValidator? ...

Validating Crontab Entries w/ PHP

What is the best way to validate a crontab entry with PHP? Should I be using a regex, or an external library? I've got a PHP script that adds/removes entries from a crontab file, but want to have some way to verify that the time interval portion is in a valid format. ...

How to handle a reentrant validation event when showing dialog

I'm wondering how people handle a situation like this, when you have a validation event, and you need to show the user a dialog box asking him whether to continue or cancel. The problem is that when showing that dialog box, it causes another validation event because it's considered losing focus on the control again, and you end up with ...

WPF databinding/validation for URIs?

My current setup binds the Text property of my TextBox to a certain Uri object. I'd love to use WPF's inbuilt validation to detect invalid URIs, and proceed from there. But this doesn't seem to be working? I would imagine that it would throw an exception if I entered, e.g., "aaaa" as a URI. Thus, triggering my current setup, which is su...

Can you disable an ASP validation on an event click before it postbacks and performs the validation?

(ASP with c#) -Can you disable an ASP validation on an event click before it postbacks and performs the validation? I would like to load some details into a bunch of text-boxes with field validators on them, However I need to Disable the validation of these text-boxes in order to actually fill them as the validation seems to occur at p...

How to fake a validation error in a MonoRail controller unit-test?

I am running on Castle's trunk, and trying to unit-test a controller-action where validation of my DTO is set up. The controller inherits from SmartDispatcherController. The action and DTO look like: [AccessibleThrough(Verb.Post)] public void Register([DataBind(KeyReg, Validate = true)] UserRegisterDto dto) { CancelView(); if...

div with id="end" on masterpage breaks .NET validation

Quick info: I'm using latest release of .NET 2.0, and the following is a stripped down test page I wrote to reproduce the error. Excluding header bits, (there is no included/inline css or javascript) My content page looks like this: <asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="server"> <div> <asp:ValidationSumma...

Validation in the middle tier

I want to do validation on my business code. I'm thinking on 2 ways to do this. One, do the validation on my class property setters in the following fashion class Student{ public string Name{ get { return _name; } set { if (value.IsNullOrEmpty) throw exception ... } } } Now, the problem with this approach ...

Validate QueryStrings in ASP.NET

Hi, Is there a library out there which I can use in my current ASP.NET app, to validate queryStrings? Edit ~ Using Regex to look for patterns, like string, only, numeric only, string with length x,...etc Thanks ...

Locking down valid characters in a Textbox

I need to be able to lock down the valid characters in a textbox, I presently have a regex which I can check each character against such as [A-Za-z] would lock down to just Alpha characters. protected override void OnKeyPress(KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Back) { base.OnKeyPress(e); return; } ...

Why won't this XHTML form validate?

Any ideas why this won't validate here: http://validator.w3.org/#validate_by_input It seems the form input tags are wrong but reading through the XHTML spec they should validate fine. Any ideas? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.o...

Validating an ASP.NET user control from its parent page

I have an asp.net page with a button. This button generates and inserts a user control into the page, so many controls could exist on one page. I need to validate that a certain dynamically generated control inside the generated control exists. So..Page has 0 to N Control1’s. Each Control 1 can have 0 to N Control2’s. When SaveButt...

Client-side verification of credit cards

Does anyone have a library or JavaScript snippet to verify the check digit of credit cards before the user hits Submit? ...

Validating a Postscript without trying to print it?

Saving data to Postscript in my app results in a Postscript file which I can view without issues in GhostView, but when I try to print it, the printer isn't able to print it because it seems to be invalid. Is there a way to validate / find errors in Postscript files without actually sending it to a printer? Preferred would be some kind ...

XML Schema Validation with RelaxNG

Which XML validation tools can you recommend for both performance and accuracy, each of which is a critical issue on our system? We have the following requirements: It is not not xmllint (see below) Supports RelaxNG Can easily integrate with Perl (this is optional, but it would be nice) Why not xmllint? (This is background and you ...

Javascript - multiple client-side validations on same event

I am performing two validations on the client side on the samve event. I have defined my validations as shown below btnSearch.Attributes["OnClick"] = "javascript:return prepareSave(); return prepareSearch();" Pseudo code for prepareSave(): { if (bPendingchanges) { return confirm('Need to save pending changes first, click ...

Eclipse 3.4 Ganymede Javascript Validation Issue

I just upgraded to Eclipse 3.4 for the second time and I think its for good now. The first time (right when it was released) was too buggy for me to stomach (mainly the PDT 2.0 plug-in); but now it seems to be all worked out. My problem is the Javascript validator. If I define a class in one JS file in my project, then try to use it in ...

How to drop a validation set in included module?

Is there a way to drop a validation that was set in Rails plugin (or included module)? Let's say I have some model with module included in it: class User < ActiveRecord::Base include SomeModuleWithValidations # How to cancel validates_presence_of :something here? end module SomeModuleWithValidations def self.included(base) ba...