form-validation

Using Zend Framework and setting a Zend_Form_Element form field to be required, how do I change the validator used to ensure that the element is not blank

Hi, When using a Zend_Form, the only way to validate that a input is not left blank is to do $element->setRequired(true); If this is not set and the element is blank, it appears to me that validation is not run on the element. If I do use setRequired(), the element is automatically given the standard NotEmpty validator. The thing is...

How to Dynamically Generate String Validation?

Does anyone know of a library (preferably php) or algorithm for auto-generating regex's from some common descriptions? For example, have a form with the possible options of: Length (=x, between x & y, etc) Starts with Ends with Character(s) x(yz) at index i Specify one or more alternative behavior based on the above And so on.. The ...

ASP.Net word count with a custom validator

A requirement for an ASP.Net 2.0 project I'm working on limits a certain field to a max of 10 words (not characters). I'm currently using a CustomValidator control with the following ServerValidate method: Protected Sub TenWordsTextBoxValidator_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidate...

Best Refactor to Handle Multiple jQuery Email Field Form Validation

What is the best way to refactor the attached code to accommodate multiple email addresses? The attached HTML/jQuery is complete and works for the first email address. I can setup the other two by copy/pasting and changing the code. But I would like to just refactor the existing code to handle multiple email address fields. <html> <hea...

A potentially dangerous Request.Form value was detected from the client

Everytime a user posts something containing < or > in a page in my webapp, I get this exception thrown. I don't want to go into the discussion about the smartness of throwing an exception or crashing an entire webapp because somebody entered a character in a textbox, but I am looking for an elegant way to handle this. Trapping the exce...

WPF Validation for the whole form

Hi, I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"? For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 lines of code in WPF!! I can do this using my own ValidationEng...

ASP.NET MVC Client Side Validation

I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation. I know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted. I have seen an interesting article by Steve Sanderson... using Live Validation, Castl...

Regexp recognition of email address hard?

I recently read somewhere that writing a regexp to match an email address, taking into account all the variations and possibilities of the standard is extremely hard and is significantly more complicated than what one would initially assume. Can anyone provide some insight as to why that is? Are there any known and proven regexps tha...

UK Postcode Regex (Comprehensive)

I'm after a regex that will validate a full complex UK postcode only within an input string. All of the uncommon postcode forms must be covered as well as the usual. For instance: Matches CW3 9SS SE5 0EG SE50EG se5 0eg WC2H 7LT No Match aWC2H 7LT WC2H 7LTa WC2H Are there any official or even semi-official regexes in use for this...

US Phone Number Verification

I have a website form that requires a US phone number input for follow up purposes, and this is very necessary in this case. I want try to eliminate users entering junk data 330-000-0000. I have seen some options of third parties that validate phone numbers for you, however idk if that is the best option for this situation. However if yo...

How do I stop Chrome from yellowing my site's input boxes?

Among other text and visual aids on a form submission, post-validation, I'm coloring my input boxes red to signify the interactive area needing attention. On Chrome (and for Google Toolbar users) the auto-fill feature re-colors my input forms yellow. Here's the complex issue: I want auto-complete allowed on my forms, as it speeds users ...

PHP based form validation

I'm looking for an easy to use, reasonably complete form validation solution for php. I recall using one years ago that used a few tags on the HMTL side then captured the OB to replace them with some pretty serious code. This feels slightly like overkill me, yet I'm not REALLY wanting to go nuts with my own right now. I'm using SMARTY...

Strict HTML Validation and Filtering in PHP

I'm looking for best practices for performing strict (whitelist) validation/filtering of user-submitted HTML. Main purpose is to filter out XSS and similar nasties that may be entered via web forms. Secondary purpose is to limit breakage of HTML content entered by non-technical users e.g. via WYSIWYG editor that has an HTML view. I'm ...

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 Safely Accept Pasted <embed> Code (PHP)

I want to allow users to paste <embed> and <object> HTML fragments (video players) via an HTML form. The server-side code is PHP. How can I protect against malicious pasted code, JavaScript, etc? I could parse the pasted code, but I'm not sure I could account for all variations. Is there a better way? ...

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" ...

Where do you record validation rules for form data in a web application?

Say you have a web form with some fields that you want to validate to be only some subset of alphanumeric, a minimum or maximum length etc. You can validate in the client with javascript, you can post the data back to the server and report back to the user, either via ajax or not. You could have the validation rules in the database and ...

Are there open source CAPTCHA solutions available?

I'm in the process of adding CAPTCHA validation to one of my websites and need to know what open source solutions exist. Please note strengths and weaknesses and what platform they work with. I'm primarily interested in ASP.NET solutions but feel free to include PHP, Java, etc. ...

Calling a control's Validate() method using Reflection

Hi All, I'm currently in the process of writing a wizard and want to make each page validate before moving onto the next page. I want to prevent the user from progressing by calling the Validate() method on every child control on the page and and stopping navigation if any of them fail. The problem is that the Validate() method on eve...

listbox validation

how do i check if an item is selected or not in my listbox? so i have a button remove, but i only want that button to execute if an item is selected in the list box. im using asp.net code behind C#. I'd prefer if this validation occurred on the server side. cheers.. ...