input-validation

Zend_Filter_Input and empty values

I’m using Zend_Filter_Input to validate form data and want to customize the error messages, if a user does not enter a value. It is important that each field gets a different error message. With Zend Framework 1.8.0 I used the following array for the “validator” parameter of Zend_Filter_Input: $validators = array( 'salutation' => arra...

Regex in python

I'm trying to use regular expression right now and I'm really confuse. I want to make some validation with this regular expression : ^[A-Za-z0-9_.][A-Za-z0-9_ ]* I want to make it so there is a limit of character (32) and I want to "match" all the string. ex: string : ".hello hello" -this should work string : ".hello hello /.." -T...

Regex for Encoded HTML

I'd like to create a regex that will match an opening <a> tag containing an href attribute only: <a href="doesntmatter.com"> It should match the above, but not match when other attributes are added: <a href="doesntmatter.com" onmouseover="alert('Do something evil with Javascript')"> Normally that would be pretty easy, but the HTML ...

jQuery Combo Boxes (User Selection) / Text Validation

Is there a way to have a text validation tool for jQuery such that: Box 1: Hi Box 2: Automatically fills with Hi if Hi is entered in Box 1 In another case if, Box 1: Bye Box 2: If the user enters Bye in Box 2 it says that they entered an invalid response Also is it possible to have it such that if Choice A is selected in a a combo bo...

How to handle comma separated decimals and floats in CF?

I have to validate form values as integers. I have tried something like this: <cfloop collection="#form#"> <cfif form.value eq int(form.value)> #form.value# is an integer </cfif> </cfloop> It works as long the user does not input comma as the decimal separator, which is the default way of doing this here in Germany. I have to us...

Making one of a group of similar form fields required in CakePHP

I have a bunch of name/email fields in my form like this: data[Friend][0][name] data[Friend][1][name] data[Friend][2][name] etc. and data[Friend][0][email] data[Friend][1][email] data[Friend][2][email] etc. I have a custom validation rule on each one that checks to see if the corresponding field is filled in. Ie. if data[Friend][...

Validation in my CakePHP seems disabled

I'm following the blog tutorial on CakePHP website, but validation doesn't work and i don't understand why, because i'm using the blog tutorial code. I'll report directly from my files anyway... MODEL class Post extends AppModel { var $name = 'Post'; var $validate = array( 'title' => array( 'rule' => 'notEmpty' ...

[WebForms] Validate more than two words as minimum on asp:textbox

Hello I want to validate the input, so the method for count words is the following : public static string validateisMoreThanOneWord(string input, int numberWords) { try { int words = numberWords; for (int i = 0; i < input.Trim().Length; i++) { ...

use a startdate on a <cfinput type= "datefield"> in ColdFusion

Hello, I am using the <cfinput type="datefield"> and I need to limit the dates that can be chosen. I cannot allow a date that can be selected in the past. Any help here? Thanks! ...

Should you code to protect your application from bad coders?

It's no question that we should code our applications to protect themselves against malicious, curious, and/or careless users, but what about from current and/or future colleagues? For example, I'm writing a web-based API that accepts parameters from the user. Some of these parameters may map to values in a configuration file. If the ...

How can I ensure my user's data is valid in PHP and MySQL?

I have a web form that takes 2 string values and 2 integer values from a user and stores them in a database. How can I ensure that the ints are actually ints and sanitze input so that Bobby Tables doesn't pay me a visit? Here is my forms code: if(isset($_POST['submit'])) { $formTitle = $_POST['title']; $formAuthor = $_POST['au...

Display custom validation messages using CakePHP $validate array

I'm trying to display custom messages like, 'this field should not be empty' or 'name not null' using the $validate array in the model. I have two controllers, main and users. The index file of the main controller has the login and registration views. The action part of the login and register functions are in the user_controller. If the...

How do I validate a date in YYYY-MM-DD format in Perl?

Related/Possible duplicate: How can I validate dates in Perl? I have created a script where start and end date needs to be given by user while executing the script. The date format entered by user should be in YYYY-MM-DD format only. start_date = $ARGV[0]; end_date = $ARGV[1]; please advise. ...

Should i sanitize markdown?

For my post entity i store both HTML and MARKDOWN in database (HTML is converted from MARKDOWN). HTML is for rendering on page and MARKDOWN for editing ability (with WMD). I sanitize HTML before storing to db. Question is: should i sanitize markdown too? or it is xss-safe if i only pass it to wmd-editor? ...

Alert box a good practice or not

I have a web form with more than 10 fields that are submitted to the database. So before submitting the values I am doing JavaScript validation. Currently I am using JavaScript validation and shows an alert box if an error occurs in data entry. Is it a good practice to show alert box when JavaScript validation fails or should I use asp...

Checking an empty tag in POST -field by Javascript

How can you check an empty tag -field by Javascript like in asking questions at SO? I would not like to pass the user to send a question without specifying the tag. ...

ASP.NET : how to do just Server-side validation ?

what are the ways to do server-side validation in an asp.net web form? Using custom validator and it's serverValidate event? or what else? ...

How do I pass form elements to a javascript validation function?

I have a form that lists users, and for each user there is a drop down menu (2 choices: waiting, finished) and a comments textbox. The drop down menus are each labeled "status-userid" and the comments textbox is labeled "comments-userid" ... so for user 92, the fields in his row are labeled status-92 and comments-92. I need to validate...

How can Request Validation be disabled for HttpHandlers?

Is it possible to disable request validation for HttpHandlers? A bit of background - I've got an ASP.NET web application using an HttpHandler to receive the payment response from WorldPay. The IIS logs show that the handler is being called correctly from WorldPay, but the code inside the handler is never called. If I create a physical...

ASP.NET Dynamic Data Validation of Navigation Properties

Hi, I've scaffolded some entities with Dynamic Data, and while it's simple to validate the regular properties, either with attributes or partial-class methods, I can't figure out how to validate navigation properties, for example, a list of players on a team represented by a dropdown in details view. There is no "on-changing" method for...