input-validation

ASP.net validation from codebehind

Hey guys, the following problem arises. I created an entry template for data which is repeated several times. Now I want to make sure at least one of these items is filled in. the way I do this is use the Count property from a generic list List to see how many are are used(there's some logic in my control that allows me to just pick ou...

JQuery form gets submitted even validation is returning false

My below mentioned code still submits form on special character in name field. Validation works but If I submit repeatedly it breaks and submits the form with special chars in name. What could be the reason for this? $("#fee").submit(function(){ trimmedValue = $.trim($("#name").val()); $("#name").val(trimmedValue); typevalue =...

Setting type "password" inputs with value from previous submit after validation failure

I'm creating a walkup create account page for our website. I've always cleared out the default value="" for a type="password" input out of paranoia, after a user has submitted a form, even if the two passwords match and are valid. I started to think on this after our designer asked me if there was any real point to doing that. I can cert...

Using the NetBeans GUI editor, how can I create a JTextField or JFormattedText field that must be validated against a regular expression?

I have a regular expression (\d{4}\w{3}(0[1-9]|[12][0-9]|3[01])([01][0-9]|2[0-3])([0-5][0-9]){2}) that I need to validate the input of a text field against when the user clicks the OK button or moves the cursor to another field. That I know how to do, writing the code. However, I'm interested in if it's possible to have the NetBeans GUI ...

Can TDD be a valid alternative to overkill data validation?

Consider these two data validation scenarios: Check everything everywhere Make sure that every method that takes one or more arguments actually checks them to ensure that they're syntactically valid. Pros Very fine check granularity. If the code that is being written is for some kind of library we make sure to limit the damage that ...

Replacing regular expression with keycode data

Public ReadOnly Property IsAlphaNumeric(ByVal entry As String) As Boolean Get Return New Regex("(?!^[0-9]*$)(?!^[a-zα-ωA-ZΑ-Ω]*$)^([a-zα-ωA-ZΑ-Ω0-9]{6,15})$", RegexOptions.IgnoreCase).IsMatch(entry) End Get End Property This one is pretty good for Greek and English language. What about all the other languages in the universe? S...

double base64 encoding danger & base64 security

I'm adding some capabilities to an api to allow third parties to store user data. I know some users may already base64 encode their user ids before submitting them through the api, others might not. I've done some checking on double encoding (encoding base64 of an already base64 encoded string), and it doesn't SEEM to be causing any pr...

Parsing impossible dates in C#

Is there an elegant way to be permissive in date input in C# to accommodate user input like '2009-09-31' (e.g. September 31, which doesn't exist and causes DateTime.Parse to choke)? Ideally I would like to parse this as October 1 (e.g. latest possible date plus overflow). ...

[asp.net mvc] xVal Cliend side validation with ajax, RenderPartial form

Hi there I'm not sure if my issue is more general or only xVal specific. At the moment I have a form with an undefined list of partial forms Something like this. There I load a partial form with Ajax, with xVal I attach also a validator. My problem now is that the rendered form is not validated until a postback. Is there any possibil...

Input Validation When Using a Rich Text Editor

I have an ASP.NET MVC application and I'm using CKEditor for text entry. I have turned off input validation so the HTML created from CKEditor can be passed into the controller action. I am then showing the entered HTML on a web page. I only have certain buttons on CKEditor enabled, but obviously someone could send whatever text they wan...

How can I capture event on adding item in Sharepoint Blog Site

I have tried Visual Studio Site Solution generator for building Sharepoint Site solution. My requirement is to validate blog entries with some criteria at run time. I want to add the same Bad Keyword thing I had asked earlier. But Visual Studio Site Solution generator is unable to create solution for Blog Site and showing below error ...

PowerShell cmdlet parameter validation

I'm writing a custom PowerShell cmdlet, and I would like to know which is the proper way to validate a parameter. I thought that this could be done either in the property set accessor or during Cmdlet execution: [Cmdlet(VerbsCommon.Add,"X")] public class AddX : Cmdlet { private string _name; [Parameter( Mandatory=false...

Restricting text box inputs to a given regexp using jQuery

Consider the following text box: <input type="text" name="quantity" id="quantity_field" /> Using jQuery I want to restrict the set of valid inputs into quantity_field by the following regexp: <script> var quantityRegexp = "^(0|[1-9]+[0-9]*)$"; </script> More specifically I want to make the browser discard any characters entered ...

compare operators

How do I Create a webpage using JavaScript that takes a number from the user and compares it against three ranges of numbers, unsing 3 functions, checklow(), checkmedium() and checkhigh()? ...

When form validation fails, how to pass error information for new try?

I'm developing a form validation class in PHP. When form validation fails, I can easily redirect again to the form's html page but without error information. I would like to redirect to the form's page with the specific errors about which fields failed and why. How should I do this? Should I send information back via GET or POST? and in...

How do I validate a text box to only allow letters and numbers using a regular expression?

I want to validate a text box that doesn't accept any special characters using regular expressions. It just takes letters and numbers from 0 to 9. Please provide me the correct regex. ...

ASP.NET: Validate file size (width and height) before upload.

Hello! Is there some way to validate the image size (height and width) before upload it to server? I think is using Javascript but I don't know how. Or maybe with some client asp.net validator. Any advice? ...

A very basic question about the way GUI integrated with the Logic classes

hi, assume i have a huge input form, which of course representing classes. i need this input to be loaded into the class's instances. this input obviously contains (some very complicated validation) checks, obviously the logic layer contains those input validation already. the question is what am i doing with gui. should i just, in a v...

Best practices to deal with absent/wrongly typed GET variables?

What do you do when you detect your get request is broken or is passing wrong types of data? Say you have a forum-page.php?forum=3 that lists all the topics related to forum 3. What would be a good way to deal with the absence of the "forum" variable? What about if instead of being an integer, you would get a string? How would you respo...

Is ASCII "../" the only byte sequence that indicates a directory traversal in PHP?

I have a PHP app that uses a $_GET parameter to select JS/CSS files on the filesystem. If I deny all requests in which the input string contains ./, \ or a byte outside the visible 7-bit ASCII range, is this sufficient to prevent parent directory traversals when the path is passed to PHP's underlying (C-based) file functions? I'm aware...