input-validation

Custom RegEx expression for validating different possibilities of phone number entries?

Hi, I'm looking for a custom RegEx expression (that works!) to will validate common phone number with area code entries (no country code) such as: 111-111-1111 (111) 111-1111 (111)111-1111 111 111 1111 111.111.1111 1111111111 And combinations of these / anything else I may have forgotton. Also, is it possible to have the RegEx ex...

Regular Expression - Password Validation is not working

Hi, I have to validate the password using regex. The password rule is like at least 1 uppercase and at least 2 numeric. It works fine except if the character comes at the end of the string. The regular expression which i am using is "^(?=.*\d.{2})(?=.*[A-Z].{1})(?=.*[@#$%^&+=].{2}).{8,12}$" Rules: minimum length = 8 minimum uppe...

Input validation in WPF

i am developing an application in wpf using MVVM design pattern. i have a listbox when an item is slected then a dialog is open having the same record in editable mode. this dialog is binded with the selected item of the list. i have apply the validation rule for textbox using IDataErrorInfo. when the user update a record on dialogbox th...

How do I check if selected value of the ListBox is not selected in C#?

This code will display the selected value from the listbox. E.g. if I sellect Item 1 I will get the following output: You have selected Item 1. Label1.Text = "You have selected " + DropDownList1.SelectedValue + "<br />"; But if I don't select anything and click on Submit button, I will get: You have selected What would I need to make...

Detect whether or not a specific attribute was valid on the model

Having created my own validation attribute deriving from System.ComponentModel.DataAnnotations.ValidationAttribute, I wish to be able to detect from my controller, whether or not that specific attribute was valid on the model. My setup: public class MyModel { [Required] [CustomValidation] [SomeOtherValidation] public st...

Validating input using java.util.Scanner

I'm taking user input from System.in using a java.util.Scanner. I need to validate the input for things like: It must be a non-negative number It must be an alphabetical letter ... etc What's the best way to do this? ...

GUI control for representing amount of time

I have an input asking the submitter how long an event took. Right now it's a normal textbox that should error out if anything but an integer is submitted. I tell the submitter to input the length in whole minutes. However, thinking in minutes isn't the brains best ability... Neither is following instructions, so I often get "support-re...

Model vs Input Validation for MVC 2 .NET

Hello, mvc 2 comes wit built-in support of Model validation but how do i do "input validation". for example i have an interface of creating memo where i have populated the view with dynamic checkboxes corresponding to employees. The validation is straight forward i.e do not submit if no checkbox is selected. i wonder if there is a way o...

javascript validation on text boxes created dynamically

In a form a text box is created dynamically by clicking on add button such that the text box is created in a new row.Now my problem is the validation of text boxes which were created dynamically such that it shows a message if any of text boxes are left empty when form is submitted by clicking submit button.Please help me out. EDIT <...

Restrict string input from user to alphabetic and numerical values

Basically, my situation requires me to check to see if the String that is defined by user input from the keyboard is only alphabetical characters in one case and only digits in another case. This is written in Java. my current code: switch (studentMenu) { case 1: // Change all four fields System.out....

How can i turn off ASP.NET required field validator "lost focus" behaviour

Hi, I have some code where I need two separate required field validators for one control, both in separate validation groups which are then validated by two separate buttons. This approach works well when the buttons are clicked but both validators show if I enter a value in the textbox and then remove it. Is there a way to turn this"...

issues with c++ executbale

Hi, I have c++ generated executable in solaris 8. the problem i am having is that this executable uses a cmd line param to run. for example, $ myprog 123412341234AB this is a valid 14 digit hexdecimal value. however, if for some reason there are symbols like ^ > < >> << & etc then the program does not behave properly per say. i ...

Silverlight 3 set focus to UIElement by name?

I'm doing some validation, I want to do the validation in the ViewModel (yes using MVVM pattern). this is what I am after roughly: SearchResult srs = _viewModel.Search(); if ( srs.Result == Result.Failed ) { MessageBox.Show(srs.ErrorMessage); SetFocusToControl( srs.ControlNameWithError ); } the SetFocusToControl() is what requir...

ASP.NET MVC: WHY ValidateInput(false) works only when the postback action and controller are explicit on the Form?

Hello, The whole weekend, I've been learning how to use TinyMCE with ASP.NET MVC. I was getting the XSS error ("A potentially dangerous Request.Form value was detected from the client(...)"). To deal with that, I was advised to use the [ValidateInput(false)] attribute to release the checking, but without success. Until, by accident, I...

Should I duplicate validation in my MVC layer and Service layer?

I'm feeling a little conflicted at the moment. I have a web application using Stripes for an MVC framework and Spring/Hibernate for the back-end. I have an account registration method in my MVC layer which requires the following validation: Username is not already taken The provided email address is not already associated with another...

WPF Validation: Clearing all validation errors

Hi ! I have a WPF UserControl with many other controls inside of it. TextBoxes are among these. Every TextBox has its own validation: <TextBox> <TextBox.Text> <Binding Path="MyPath" StringFormat="{}{0:N}" NotifyOnValidationError="True"> <Binding.ValidationRules> <r:MyValidationRule ValidationTyp...

PHP function to turn arbitrary "description" into valid xml data for podcast feed

I am reading the documentation for creating a podcast feed suitable for iTunes, and the Common Mistakes section says: Using HTML Named Character Entities. <! — illegal xml — > <copyright>&copy; 2005 John Doe</copyright> <! — valid xml — > <copyright>&#xA9; 2005 John Doe</copyright> Unlike HTML, XML supports only five "named c...

Which function in php validate if the string is valid html?

Hi, Which function in php validate if the string is html? My target to take input from user and check if input html and not just string. Example for not html string: sdkjshdk<div>jd</h3>ivdfadfsdf or sdkjshdkivdfadfsdf Example for html string: <div>sdfsdfsdf<label>dghdhdgh</label> fdsgfgdfgfd</div> Thanks ...

Best practices for user physical location (input, data type, display and validation)

I'm building a web application that requires users to provide their location (similar to the way Facebook does it). I'm not sure on the best way to implement this. I require the ability to search through records of another entity (call it 'events') which also have a physical location attached to it, and match the users in the same or clo...

Best practices for input validation in ASP.NET?

What is the common practice of input validation? In other words do you check for input validation on client-side, on server-side or on both sides? Also, if performance is crucial to me, would just the client-side input validation be sufficient for my website without presenting any security risks? ...