validation

Asp.NET Regular Expression Validator (Password Strength)

I have a validation control that has the following expression: (?=(.*\\d.*){2,})(?=(.*\\w.*){2,})(?=(.*\\W.*){1,}).{8,} That's a password with atleast 2 digits, 2 alpha characters, 1 non-alphanumeric and 8 character minimum. Unfortunately this doesn't seem to be cross-browser compliant. This validation works perfectly in Firefox but ...

Should I make sure arguments aren't null before using them in a function.

The title may not really explain what I'm really trying to get at, couldn't really think of a way to describe what I mean. I was wondering if it is good practice to check the arguments that a function accepts for nulls or empty before using them. I have this function which just wraps some hash creation like so. Public Shared Function G...

Multi page forms in Rails

I'm having a quite complex model with many fields, has_many associacions, images added by image_column etc... New object will be added by multi page form (8 steps) - how shoud I accomplish validation and propagation between those steps? I think validation_group could be useful for defining validations for each step, what about overall ...

What is the best regular expression for validating email addresses?

Over the years I have slowly developed a regular expression that validates MOST email addresses correctly, assuming they don't use an IP address as the server part. Currently the expression is: ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$ I use this in several PHP programs, and it works most of the time. How...

Regular expression that calls string "a?c" invalid?

In my user model, I have an attribute called "nickname" and validates as such: validates_format_of :nickname, :with => /[a-zA-Z0-9]$/, :allow_nil => true However, it is currently letting this string pass as valid: a?c I only want to accept alphanumeric strings - does anyone know why my regular expression is failing? If anybody c...

jQuery Validation plugin: disable validation for specified submit buttons

I have a form with multiple fields that I'm validating (some with methods added for custom validation) with Jörn Zaeffere's excellent jQuery Validation plugin. How do you circumvent validation with specified submit controls (in other words, fire validation with some submit inputs, but do not fire validation with others)? This would be si...

How to validate that a string doesn't contain HTML using C#

Does anyone have a simple, efficient way of checking that a string doesn't contain HTML? Basically, I want to check that certain fields only contain plain text. I thought about looking for the < character, but that can easily be used in plain text. Another way might be to create a new System.Xml.Linq.XElement using: XElement.Parse("<...

How can I check the syntax of Python code in Emacs without actually executing it?

Python's IDLE has 'Check Module' (Alt-X) to check the syntax which can be called without needing to run the code. Is there an equivalent way to do this in Emacs instead of running and executing the code? ...

ASP.NET Page Validation

Related Article On a similar topic to the above article, but of a more specific note. How exactly do you handle items that are in the viewstate (so they are included on submit), but can also be changed via AJAX. For instance, say we had a dropdown list that was populated through an AJAX web service call (not an update panel). How can I ...

PHP validation/regex for URL

I've been looking for a simple regex for URL's, does anybody have one handy that works well? I didn't find one with the zend framework validation classes and have seen several implementations. Thanks ...

RequiredFieldValidator Help

Quick question: I have multiple RequireFieldValidators on my aspx page. On the backend (C#) I want to be able to tell which control specifically wasn't valid so I can apply a style to that control. I use the Page.IsValid method to see if the overall page passed validation but I need to know specifically which one control failed. Tha...

jQuery - Live Validation Plug-ins

I'm looking for a plugin for jQuery that can validate as a key is pressed and after it loses focus (text boxes). I'm currently using jVal - jQuery Form Field Validation Plugin. It works pretty good. The only issue I have is that I can only use a generic error message. For example: I need a string to between 2 and 5 characters. If ...

jQuery and jVal Validation Plug-in. Adding an attribute to an element.

I'm trying to add the jVal attribute to a textbox that I created in the HTML. <input id="subJobName" type="text" jval="{valid:function (val) { return validateSubJobName(val); }, message:'Name already exists or is longer than 14 characters.', styleType:'cover'}" /> I would let to add /set the jVal in the javascript instead. 2 reasons ...

Why are people using regexp for email and other complex validation?

There are a number of email regexp questions popping up here, and I'm honestly baffled why people are using these insanely obtuse matching expressions rather than a very simple parser that splits the email up into the name and domain tokens, and then validates those against the valid characters allowed for name (there's no further check ...

Struts2 Validation at the action vs domain object level

The struts2 validation framework allows you to define your validation for an action or at the domain object level. My question is, is there an advantage or disadvantage using one over the other? What do you recommend? My own findings: You may use the same domain objects in several actions and may have to re-define validation rules per ...

How do I validate the class diagram for a given domain?

I am working on car dealership business domain model/UML class diagram. I am new to modeling, so I would like to know how to validate the class diagram. It's very important for me to have an appropriate, if not 100 percent correct, class diagram to use further development (use cases, etc.). Is it possible to build a completely incorrec...

.Net object validation frameworks

I'm working on an ASP.NET project using MVP architecture. We would like to use an object validation framework in the domain, but are not that familiar with available frameworks other than the Castle.Components.Validator namespace. Does anyone have experience with any other light-weight object validation frameworks. If not, what appr...

RequiredFieldValidator - how to get rid of the default red font color

I can't seems to change the default color of the required field validator. In the source it is: <span class="required">*</span> <asp:RequiredFieldValidator ID="valReq_txtTracks" runat="server" ControlToValidate="txtTracks" Display="Dynamic" /> Here's what I have in my .skin file: <asp:RequiredFieldValidator runat="server" ...

Make html validation part of build cycle

Currently when I build my site I have to manually open validate it at the 3wbc site (means when opera pops up, press ctr+alt+shft+u) for every page. Is it possible to automatically validate every page whenever I build my pages? P.s.: This page doesn't validate ;) ...

Inline script does not resolve in ASP.Net custom control

Currently I am working with a custom regular expression validator (unfortunately). I am trying to set the Regex pattern using a server side inline script like this: ValidationExpression="<%= RegExStrings.SomePattern %>" However, the script is not resolving to server side code. Instead it is being interpreted literally and I end up wi...