validation

Best way to do client/server validation in ASP.NET in 2010?

First there was the ASP.NET validators and we used them... Then some people on the team did things manually in javascript... Then a bunch of jquery validation libraries came out... Then MVC2 came out with attributes as validators.. I work with apps that have alot of forms with alot of various validation (Some fields needs to be compared...

Custom RegEx expression for validating different possibilities of phone number entries?

Hi, I'm looking for a custom RegEx expression (that works!) to will validate common phone number with area code entries (no country code) such as: 111-111-1111 (111) 111-1111 (111)111-1111 111 111 1111 111.111.1111 1111111111 And combinations of these / anything else I may have forgotton. Also, is it possible to have the RegEx ex...

How to update attributes without validation

I've got a model with its validations, and I found out that I can't update an attribute without validating the object before. I already tried to add on => :create syntax at the end of each validation line, but I got the same results. My announcement model have the following validations: validates_presence_of :title validates_prese...

Regular Expression to match IP address + wildcard

Hey guys I'm trying to use a RegularexpressionValidator to match an IP address (with possible wildcards) for an IP filtering system. I'm using the following Regex: "([0-9]{1,3}\\.|\\*\\.){3}([0-9]{1,3}|\\*){1}" Which works fine when running it in LINQPad with Regex.Matches, but doesn't seem to work when I'm using the validator. Doe...

jQuery Validator - Dynamic Text

Adding a validator to my form: jQuery.validator.addMethod('whatever', function(val, el) { // whatever goes here }, 'A maximum of ' + $('#my_id_here').val() + ' categories can be selected.'); This doesn't fly. I always get undefined. Is this a good, simple way to do this? Thanks ...

Using DataAnnotations with Entity Framework

I have used the Entity Framework with VS2010 to create a simple person class with properties, firstName, lastName, and email. If I want to attach DataAnnotations like as is done in this blog post I have a small problem because my person class is dynamically generated. I could edit the dynamically generated code directly but any time I ...

Lisp data security/validation

This is really just a conceptual question for me at this point. In Lisp, programs are data and data are programs. The REPL does exactly that - reads and then evaluates. So how does one go about getting input from the user in a secure way? Obviously it's possible - I mean viaweb - now Yahoo!Stores is pretty secure, so how is it done? ...

Validation strategy for the unit of work pattern

When I use the unit of work pattern (with JPA), I get an entity from a repository, modify it and save the modifications at the and of the unit of work implicitly to the database. Now I wonder how to perform validation with the unit of work pattern. If I apply changes (from user input) to a domain object and validate after that, the val...

[ASP.NET] A CustomValidator doesn't need to have it's ControlToValidate property set, so...

Hi: I've just finished reading up on the CustomValidator control and I have a question. In the book I'm reading, it says that a CustomValidator doesn't need to have it's ControlToValidate property set and it gives a few examples of that usage. But in one example where ControlToValidate isn't used, the OnServerValidate function has a tim...

Javascript culture always en-us

I'm not sure if I understand this code or if I'm using it right, but I was under the impression that in an ASP.NET 2.0 AJAX website I could run javascript like: var c = Sys.CultureInfo.CurrentCulture and it would give me the culture/language settings the user had specified in their browser at the time of the visit. However, for me, it...

Getting the date object to work in IE6 (w/ YYYY-MM-DD param)?

I just got IE6 sprung on me for a project that is going out into the wild soon, which means it's time to go back and comb through all of the CSS and JS. I've gotten hung up on the date object, however: $.validator.addMethod("dateRange", function() { var today = new Date(); var event_date_raw = $('#event_date').val(); var event_dat...

How do I add a expiration date validation to this credit card form

<table border="1"> <tr> <td> <label for="month">Expiration Month</label> <select name="month"> <script language="JavaScript" type="text/javascript"> var month = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"); for (var m=0; m<month.length; m++) { document.write("<option>" +month[m]+ "</...

How to suppress email validation when using SmtpClient and MailMessage

When sending out emails using the SmtpClient and a MailMessage (.net 3.5) the "To" email address(es) get validated prior to sending. I've got a big stack of email addresses which have a dot (.) before the at-sign, causing a FormatException when you attempt to send the message using the SmtpClient. This is actually a good thing, because b...

Validate xml on Mono

Hello I have a .net application which I want to port to Mono. The application takes a xml file validates it and "executes" the xml. The validation part is not working on Mono. The xml is validating against XSD. XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationEventHandler += new System.Xml.Schema.ValidationEv...

PHP: Three item validation comparison

I have 3 featured product panels on the homepage, and I'm writing a CMS page for it. I'm trying to validate the items. They are selected via three <select> elements, featured1, featured2 and featured3. The default is <option value="0" selected>Select an element</option> I need to validate the $_POST to ensure that the user hasn't selec...

POST body in Node.js and some asynchronous condition check.

I want to get request (POST) body from http.ServerRequest, but do so not straight when my request function is called, but only after some time (Redis query). I have a very simple example to illustrate: var http = require('http'), sys = require('sys'); http.createServer(function (req, res) { sys.puts("Got request"); req.pau...

iPhone Objective-C Form Validation

Hello, I am an old developer but new to Objective-C and iPhone development. I am looking for the best way to do form validation for values entered. I have been googling for a while and can't find any good code, but might be using the wrong key worrds, etc... I am looking for things like catching for empty string, numeric validation, ...

Support for nested model and class validation with ASP.NET MVC 2.0

I'm trying to validate a model containing other objects with validation rules using the System.ComponentModel.DataAnnotations attributes was hoping the default MVC implementation would suffice: var obj = js.Deserialize(json, objectInfo.ObjectType); if(!TryValidateModel(obj)) { // Handle failed model validation. } The object is com...

GWT-EXT markInvalid() red circle not getting displayed at proper place

Hi, I'm using GWT-EXT 2.3 with Java. I've a ComboBox & have applied a validation on it. If validation gets failed then a small red icon with tooltip is displayed on the right side of the field(Combobox) on which the validation is applied. My problem is i'm getting that red icon in center of a combobox (between label & textfield). Can an...

regular expression for validation not working

I have a "description textarea" inside a form where user may enter a description for an item. This is validated with javascript before the form beeing submitted. One of the validation-steps is this: else if (!fld.value.match(desExp)){ And desExp: var desExp = /^\s*(\w[^\w]*){3}.*$/gm; Now my problem, this works fine on all cas...