input-validation

How to do Php Security check for input fields and input treatment ?

Hi, How to do Php Security check for input user fields and input user treatment(please if you can solve example1+2)? Example1: check if user insert url or something else: <label>url: </label> <input type="text"> Example2: check if user insert html or something else <label>paste html: </label> <textarea></textarea> thanks ...

subdomain name validation in javascript/jquery

I have a signup form where users kan enter their subdomain of choice when creating an account. http://_________.ourapp.com I want them to be able to enter valid characters on the __________ part above only. I'm using a text field for that. Is there a function or some sort of pattern that exists for such situations? Spaces should be f...

Checkbox validation - at least one selected

Hi, I have number of checkboxes and another checkbox for "Select All" I want to check if the user has selected at least one checkbox. Need modification in javascript <script language="Javascript"> function doSubmit(){ function check_checkboxes() { checked=false; var c = document.getElementsByTagName('INPUT'); for (var i = 1; i < c....

Check if specific chars were written and trigger an error

Hi, Im trying to figure out via JS if invalid chars were entered in a textarea I want to allow only this chars: A-Za-z0-9 !#%&*()+-=,.?"';:/ If illegal chars were entered, I want to retrieve the bad chars, and trigger an error, i.e: Invalid text, bad chars were written: 1) _ 2) @ etc... Thanks! ...

ASP.NET MVC 2 Multiple PartialView Forms fieldname conflict

I have a ASP.NET MVC 2 webpage in which I render multiple PartialViews of the same type. Each partial view contains a Ajax-form for posting smth. The form consists of: an input: EditorFor(m => m.content) the validation for the input: ValidationMessageFor(m => m.Content) The problem is that because there are more than 1 of these forms...

Javascript validation

I have two input fields holidayDate and Description(id=tags) <html> <head> <script type="text/javascript"> $(document).ready(function() { $('#holidayDate').datepicker(); var availableTags = ["New years Day", "Martin Luther King Day","Groundhog Day", "Valentine's Day", "Washington's Birthday", "Easter", "Earth Day", "National Arb...

Trying to write a regex that matches only numbers,spaces,parentheses,+ and -

I'm trying to write a regular that will check for numbers, spaces, parentheses, + and - this is what I have so far: /\d|\s|\-|\)|\(|\+/g but im getting this error: unmatched ) in regular expression any suggestions will help. Thanks ...

Can anyone suggest a resource that lists suggested maxlengths for common fields like city, email, phone, etc?

I know email addresses are limited to 254 characters, but is there a single resource that outlines suggested maxlengths for common fields like contact information e.g. phone, city, etc? It seems every project I work people just shoot from the hip on their proposed limits. I'm hoping to find a canonical reference, targeted to a specific ...

Validate Drivers License numbers?

I am working on a ACH payment processor and was wondering if I can scope the drivers license field against some rules. Any ideas on this? Can I assume numbers only or anything else more like SSN Thanks ...

WCF Input Validation and Cross Site Vulnerabilities

We're trying to harden a WCF service that we use with an XBAP application and have some questions that we haven't been able to answer yet. To give some background: The communication between the application and service is over HTTPS. The user is authenticated using username/password. The data being sent/received is compressed (gzip) bi...

Decoupling the model and input checking

Is it a good practise to decouple input checking from a model and have it handled elsewhere, say by a controller? If so, how could this be done from an MVC or DDD standpoint? ...

sql query validator

Hi, Is there any sql query validator in frontend side or in any language for validating the query syntax before executing in the database ?.In my current project i have to validate the the sql query in flex before it goes to back end ,coz it has to pass lot many layers before hitting database and the hitting the DB and coming back wit...

How to stop someone uploading a script in textarea?

Hello I have a situation where users can submit feedback through a textarea on a HTML page or JSP. This works fine and the text ends up in the database. But, can anyone suggest any safeguards which could prevent somebody trying to submit malicious scripts which could possibly affect the page's behaviour? I am aware of parsing the tex...

Server/Client input validation for asp.net form using attribute / dataannotation

I was playing with asp.net mvc 2's DataAnnotation validation. It hookup to the client side validation very nicely. I really like that I can just define one sets of rules and be able to user it at both client and server side. I am wondering if it is possible to do it with asp.net form. The following code snippet shows how it is done, an...

How to validate if Text entered is a numeric number?

Hi there I have a calculation application which I need to validate the fields to check if the values entered are numeric numbers and not alphanumeric. I have some ideas about the codes: Please guide me if I have done anything wrong or seem noob as this is my first time trying out Swing. private void jTextField1ActionPerformed(java.aw...

Show "passed" image or text after validating an asp.net (req. field)validator

I have the following asp.net code: <asp:TextBox CssClass="mf" runat="server" ID="mail1" Width="270" /> <asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="mail1" Display="Dynamic" /> Now I want to show an image (or text) if the v...

ASP.NET Button.CausesValidation defaults to true but does not validate...

I have a "Sign up for email" user control consisting of an asp:TextBox, asp:Button, asp:RegularExpressionValidator. Nothing fancy. I'm seeing some garbage/sql injection addresses in the database suggesting the client-side validation may be bypassed. Investigation suggests that the server-side validation is also not firing. When I set En...

Validate Input to a C Program

i have a c program in which i am accepting 2 numbers as input. How do i validate if input entered is numbers only and not characters. void main() { int a,b; printf("Enter two numbers :"); scanf("%d%d",&a,&b); printf("Number 1 is : %d \n Number 2 is : %d",a,b); } [Edit] Added Sample Code ...

How to validate user input?

In the program written below how i can ensure that only integer value is entered? And if character is entered the program should convert it to its ASCII equivalent and then add them and show output as number. Please help me...... #include<stdio.h> int main(int argc, char **argv) { int a,b,c; printf("enter two numbers:-"); scanf("%d \...

Data Validation in C

I was trying out a simple program in c for validating user data. The program is supposed to identify whether a user entered character is a number, alphabet or a special character. Somehow , the code identifies every kind of input character as a number. I have appended the code below, i'd be grateful if someone could kindly point out wh...