validation

ADO.NET Data Service Exception Handling

I am looking for information on how people are handling business rule (and field validations) using an ADO.NET Data Service wrapped around an Entity Framework object context. I have seen numerous posts/articles/etc that seem to be fine with just throwing an exception. I would prefer to have an object that contains a set of errors with ...

.Net RegularExpressionValidator Help (empty or over 6 chars)?

I'm looking to accept values of (6 chars long or nothing). This is for an update form. If a password is entered, I'd like to force 6 chars long. If not, I want to ignore the field. Here's a REGEX that gets me the 6 char part, any help on handling empty also? <asp:RegularExpressionValidator id="rev1" runat="server" SetFocusOnError=...

What's the point of valid CSS/HTML?

If I've tested my pages in most major browsers, why would I need to maintain a validated code? I want to use box-shadows and corner radius if they're supported in WebKit browsers and Firefox. I don't care if they don't show up on Internet Explorer. But I keep my HTTP requests down by not including images instead. Are there are advantage...

Use ajax validation with javascript submit in nyroModal modal window

I have a form (signup.php) that pops up in a nyroModal window when I click a button: <input value="Edit" class="nyroModal" type="button" href="signup.php"> I would like to use some form of AJAX validation (to check if the user name has been taken, for example) before submitting the form. I had the following in mind: When the user cl...

Credit Card Validation Resource for UK merchant

I'm trying to set the credit card numbers based on the standard check parameters but am finding lots of UK cards (Maestro / Visa Debit / Barclaycard Connect) have start numbers that dont meet other card validation script regexes; I.e Maestro (Switch) cards are still around and start with a 4, using alot of the regex's online this would...

Drupal: Custom Content Type validation

I've created a custom content type with CCK. If I need to add some custom code for validating fields of this content type's record form, where do I add the code and which functions are best for this task? ...

How to validate input using javascript

<script type="text/javascript"> function validate() { if (document.form.price.value.trim() === "") { alert("Please enter a price"); document.form.price.focus(); return false; } if (document.form.price.value !== "") { if (! (/^\d*(?:\.\d{0,2})?$/.test(document.form.price.value))) { a...

Validation in textbox in WPF

Hi, I am currently working on a WPF application where I would like to have textbox that can only have numeric entries in it. I know that I can validate the content of it when I lost the focus and block the content from being numeri, but in other Windows Form application, we use to totally block any input except numerical from being wri...

Javascript return false - from function

Is there any way to do the following: validateLogin(); return false; But actually like this.. validateLogin(); And here is the function: function validateLogin(){ if(hi=true){ return true; } else{ return false } I want to attach this function for the event of a form being submitted, so if HI is false - i want to return false; me...

Validating XML from Twitter

When I receive XML data (via a Twitter API call, in this instance), I imagine it's best practice to somehow validate it before I begin working with it? My app has had a lot of untractable issues lately, and I want to rule out bad XML data. Does XML ever go "bad" somehow? Would an overloaded server like Twitter's ever spit out just half ...

When and how can I enforce validation in Subsonic 3?

Is there any event like OnValidate in LINQ where I can add my business validation rules so that they are ALWAYS called whenever I use Add() or Update()? If not: What do you suggest to do? I could add a partial class and wrap the Add/Update methods with own ones but then one could still use the original ones ignoring any business valida...

Using the jQuery Validation plugin, how can I display the validation errors in my own span tag?

Currently the jQuery Validation plugin is displaying an error by creating its own label tag, using the class error. Is it possible for me to place a tag on the screen, and if there is an error have the error message injected into that tag? ...

What is the regular expression for validating jabber id?

For now I'm using this regexp: ^\A([a-z0-9\.\-_\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z$ I think it is not very good. So what's the best regular expression you have or have seen for validating jids? For reference, Section 3 of the XMPP core standard defines a JID in Augmented Backus-Naur Form as jid = [ node "@" ] domain [ "...

AASM: Verifying which object is moving a state forward

I'm using AASM from http://elitists.textdriven.com/svn/plugins/acts%5Fas%5Fstate%5Fmachine/trunk In my example, I have a Karate dojo rails site. On the site, Teachers can manage the classes they instruct and move their students to the next logical belt. My "Student" model use AASM for belt progression and it's defined like this: cl...

Unhandled System.StackOverflowException when using regex in ASP.NET MVC

Hey I'm using a regular expression to check the format of a supplied date in my ASP.NET MVC exception. However, every time I run it the action the web server crashes and Visual Studio reports and unhandled System.StackOverflowException //If the supplied date does not match the format yyyy-mm-dd //Regex taken from www.regexlib.com if(!...

NHibernate Rollback w/ broken rules (validation best practice)

I'm working on a legacy system that is using the enterprise library validation block to add a broken rule when an object is not valid. Then the user is returned a message based on this error and told the object was not updated. The only issue is that now I'm using NHibernate to persist these objects -NHProf shows an update to the obj...

Allowing * in regular expression for alpha numeric

Hi, I have below code in vb.net for validating alphanumeric characters, It is working fine for all alphanumeric characters, However I want to allow user, so that he can insert "*". Please provide me the new regular expression for the above issue. <tr> <td> <asp:TextBox ID="TextBox1" runat="server"></asp...

Example string to test input boxes

Does anyone have a string they paste in when when testing html forms? Just basically something that will test their system handles every kind of crap data that can be passed in. ...

Java 5 Does not validate DTD

I am working with a vendor applet, The applet works fine with JRE 1.4.2_X and 1.6.X but fails on every version of 1.5.X. Running with 1.6 is not an option due to another application conflict that does not play nice with Java 6. The issue I believe is that the DTD is not being validated. This is causing the "not declared" problem and the...

Is there a good reference for data annotations in regards to how DataType works?

I have a customer class which has both PhoneNumber and Email properties. Using DataAnnotations I can decorate the properties with DataType validation attributes, but I cannot see what that is getting me. For example: [DataType(DataType.PhoneNumber)] public string PhoneNumber {get; set;} I have a unit test that assigned "1515999A"...