validation

Testing pointers for validity (C/C++)

Is there any way to determine (programatically, of course) if a given pointer is "valid"? Checking for NULL is easy, but what about things like 0x00001234? When trying to dereference this kind of pointer an exception/crash occurs. A cross-platform method is preferred, but platform-specific (for Windows and Linux) is also ok. Update for...

Validator in <noscript> causes JavaScript error

The following .NET 3.5 code, placed in an aspx file, will trigger a JavaScript error when the page is loaded (for users who have JavaScript enabled): <noscript> <asp:TextBox ID="txt" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="txt_RequiredFieldValidator" runat="server" ControlToValidate="txt"></asp:Requi...

SQLAlchemy/Elixir validation rules?

I just found out how to validate my database input before saving it, but I'm kinda bummed to find there are no premade rules (like validate email, length, etc) that are found in some web based frameworks. Are there any validation libraries laying around anywhere or somewhere that some premade validation lists are hiding that I haven't fo...

MVC RC Validation: Is this right?

I'm just trying to do some simple validation in MVC RC and am getting an error. For the purposes of this question, I am not using the UpdateModel. Here is the code in the form: <%= Html.TextBox("UserId")%> <%= Html.ValidationMessage("UserId") %> If I add the following line in the controller, I will get a NullReferenceException on th...

Empty HTML tags

I have a lot of empty span tags and so on in my code, due to CSS image replacement techniques. They trigger a HTML validation warning. Should I care? Thanks. ...

ASP.NET validation not executing in a JavaScript showModalDialog call

I currently open a pop up window from my parent page using using a JavaScript .showModalDialog function. The pop up window contains some ASP.NET validation controls which do not display when the user clicks the ASP.NET button to submit the form. If there is an error on the page, the validation message(s) do not display, the record is n...

Validating multi-line text input when using .NET

I have an HtmlTextArea and I want to restrict the number of characters users can input to 500. Currently I've used a RegularExpressionValidator... RegularExpressiondValidator val = new RegularExpressiondValidator (); val.ValidationExpression = "^.{0,500}$"; val.ControlToValidate = id; val.ErrorMessage = "blah"; ... this is fine when ...

How do I create a regular expression that disallows symbols?

Hey, I got a question regarding regexp in general. I'm currently building a register form where you can enter the full name (given name and family name) however I cant use [a-zA-Z] as a validation check because that would exclude everyone with a "foreign" character. What is the best way to make sure that they don't enter a symbol, in bo...

How best to validate that a URL is on the public internet?

I want to validate that a hostname/IP address is on the public internet; that is, that as far as is reasonable, I'd get the same response from it no matter where I access it from (obviously that's impossible to guarantee. ie I want to exclude localhost, 127.0.0.1, anything in the private IP ranges, and anything that has an invalid TLD. ...

Xml validation using XSD schema

The following code helps me validate an XML file with an XSD schema. XmlReaderSettings settings = new XmlReaderSettings(); settings.Schemas.Add(null, xsdFilePath); settings.ValidationType = ValidationType.Schema; settings.ValidationEventHandler += new System.Xml.Schema.ValidationEventHandler(settings_ValidationEventHandler); XmlDocument...

Validation Plugin Problem in JQuery

Dear All I am using Validation Plugin.in JQuery. My Code in IE gives Error as '$.metadata' is null or not an object. My Partial Code. $(document).ready(function() { $.validator.setDefaults({ submitHandler: function() { alert("OK"); } }); $.metadata.setType("attr", "vali...

How do I get the collection of Model State Errors in ASP.NET MVC?

How do I get the collection of errors in a view? I don't want to use the Html Helper Validation Summary or Validation Message. Instead I want to check for errors and if any display them in specific format. Also on the input controls I want to check for a specific property error and add a class to the input. P.S. I'm using the Spark Vi...

Tool for XML XSD schema validation

Does anybody know of a command line tool for validating XML with XSD schema? ...

What JavaScript library to use for client-side form checking?

Over the years, I've dabbled in plain JavaScript a little, but have not yet used any JavaScript/AJAX libraries. For some new stuff I'm working on, I would like to use a js library to do client-side form validation, and want to know which would be best for that. By best, my criteria would be: quick and easy to learn, small footprint, c...

PHP Input validation for a single input for a url.

I have this very simple script that allows the user to specify the url of any site. The the script replaces the url of the "data" attribute on an object tag to display the site of the users choice inside the object on the HTML page. How could I validate the input so the user can't load any page from my site inside the object because I h...

Validation Framework in Java

We are currently in the process of refactoring our plugin API**(JDK 1.4 compliant)** which is shipped to our clients in the form of a jar file(ie, no need to have javascripts to be generated and so forth). This is a very lightweight plugin so that we have kept away as many dependent jars as possible like Spring. During this process we st...

XHTML validation, custom namespaces and attributes

I have a website that a client requires to be XHTML valid. They check it using the W3C validator. I want to add my own namespace and attributes so I can do things like this: <div my:userid="123"> ... </div> From what I understand, defining custom namespaces is perfectly valid XHTML, as long as I do this: <html xmlns="http://www.w3.o...

What would cause ASP.NET validators not to trigger on a deployed site?

Locally it works, I know its the "it works on my machine" syndrome but i cant see why. Simple web page, fields, required field validators, such as <asp:textbox id="tbEmail" runat="server" CssClass="field"></asp:textbox> <asp:requiredfieldvalidator id="Requiredfieldvalidator2" runat="server" Display="Dynamic" ControlToValid...

Visual Studio 2008 : Turn off css class verification

Is there a way to stop Visual Studio 2008 from checking whether css classes exist when editing pages and user controls? It seems ridiculous to put dummy stylesheets on every single user control. ...

How do I do conditional validation in ActiveRecord with n conditions?

I am providing a web service to be called by external companies. The required data covers several models including person, address etc. I want to validate the received data conditionally based upon some fields within the request. I will eventually have many differing sets of validation data, although currently I only have one and I am ab...