validation

JSF2 Validation Clientside or Serverside?

Hi folks, I implemented my validation logic as follows: <h:inputText id="title" value="#{...}" required="true" requiredMessage="...some..text..." validatorMessage="...some..other..text..." > <f:validateLength minimum="10" maximum="50"/> </h:inputText> I read a lot about clientside...

Small remake of this regexp to allow these special character in beginning...

I have this regexp: var desExp = /^\s*([\wåäö][^\w]*){3}.*$/gm; This is for validating a textarea. Currently, you cant use the three Swedish language letters in the beginning. The letters are å, ä, ö, Å, Ä, Ö. Also, I would like it to allow the minus sign and the star (multiplication) sign: - and * Is there any remake to allow ...

Required field validator for multiple dropdown lists in an aspx page

I have an aspx page which has 18 (yes 18) dropdown lists and 18 text boxes. Each dropdown needs to be selected and each textbox needs to be filled. Dragging and dropping required field validators on these 36 controls and maintaining them is a painful task and does not seem to be the logical option as all I need is for the user to select ...

Validate a number with grouped thousands with decimal to the hundreth

Looking for a simple way (Function/RegEx) to validate a number with grouped thousands. Example Numbers: .00 - 999.00 should validate 1,000.00 should validate 100,000.00 etc... should validate 100,000,000,000,000.00 should validate Now I've seen the number_format(), but this formats the number not validates. I wanted to use a RegEx b...

javascript window.event coming up null ?

I am using a CustomValidator in ASP.NET as follows: <asp:CustomValidator ID="cvComment" ControlToValidate="txtComment" Display="None" EnableClientScript="true" ClientValidationFunction="validateComment" runat="server" ></asp:CustomValidator> And this is the function that gets called: function validateComment(source, args)...

ASP CustomValidator, advancing to postback after error

Hello, I have an ASP .NET page with ASP validators (Required Field, Regular Expression,...) plus java script functions for additional validation (for example, to check if second date bigger than first date, among others). I usually do: <script type="text/javascript"> function validate() { // ... alert('Not valid!'...

Manually adding text to html.ValidationSummary?

I am rather new to mvc2 and when following a writeup on data annotations and such, I came across a bit of code that let me manually add a line of text to the validation summary. I've searched for the last 2 or 3 hours and I've come to the point where I think I'm just searching for the wrong thing. Its not custom validators I'm looking f...

Is HttpPostedFile.ContentType a flawless way to validate an uploaded file?

I want to validate the file type to make sure the user is uploading an image of type JPEG, GIF, or PNG. Instead of checking the file extension, I figured using HttpPostedFile.ContentType would be safer since it checks the MIME content type. protected void cvValidateImageType_ServerValidate(object source, ServerValidateEventArgs args) { ...

How to prevent debugger from breaking when ArgumentException is thrown when using ValidatesOnExceptions=true in WPF

I am using the ValidatesOnExceptions=true method of WPF validation. This involves throwing an exception in the source's property setter method. It works but the debugger always breaks when the exception is thrown. I am guessing that this is because the exception is not caught directly in my user code but it is caught in the WPF validatio...

Entity Objects Validation and Business Rules Validation

Hi, I am developing application having business objects created from EF 4.0. The application is layered with Data Layer having repository of classes. Above that is a business layer where business processes are mapped as per the requirements. Business layer is calling data layer. Business objects have complex associations. One scenario:...

How can I make WebFlow abort the transitioning and just view the previous page when validation fails?

I have a Spring WebFlow app that causes me grey hairs. What I'm trying to accomplish if validation succeeds is to simply show the same view with different data. This works. However, when invalid data are entered, I want to show the previous view, but with the erroneous values pre-filled and the error messages telling my user how to fix t...

UK and Northern Ireland Vehicle Registration Number validator (PHP)

I need a validation function for both UK and NI vehicle registration number. It can be two separate functions too. ...

infopath 2007- how to set cannot be blank from code behind

Hi, I have two drop down list box, on certain value of first drop down list box, i want to set the other drop down list property to cannot be blank, any idea, need some urgent solution, got stuck :( ...

Going from a form command to a stored entity with validation in a Spring 3 web app

I have a form to create a user and a corresponding command object. It looks like so: public class CreateUserForm { private String name; private String email; private String password1; private String password2; private Boolean enabled = true; ... getters and setters ... } I have a user entity object that is to ...

Is this a Reasonable Validation Strategy?

Is it okay to put some custom validation methods in AppModel and call those from my app's Models? I want phone number validation to work the same for all phone numbers on my site and I want that validation rule to be in one place only. Is there a better way to do this? ...

Validating a string in Java

I have a question about validation in Java, I have looked at previous topic and none seem to answer my little problem. What I am trying to do is validate what is put into a string variable in the constructor but also when a set method is used. What I need to is If Mr Miss Mrs or Ms is entered, then to set that in a Variable (title) if ...

Is there a way to enforce a minimum string length with NHibernate?

I have a string property on an entity that I would like to mark as required. For example, public class Product { public virtual string Name { get; set; } } In my mappings, I can declare Name as required (using Fluent NHibernate): mapping.Map(x => x.Name).Required(); However, this only restricts the string from being null. If I ...

Apply and validate a bound DataGridViewComboBoxCell directly upon selection change

I have a windows forms DataGridView that contains some DataGridViewComboBoxCells that are bound to a source collection using DataSource, DisplayMember and ValueMember properties. Currently the the combobox cell commits the changes (i.e. DataGridView.CellValueChanged is raised) only after I click on another cell and the combobox cell lose...

jQuery validation regex: textarea contains phrases

I'm trying to check a textarea to make sure it contains text phrase(s). This is what I have so far but it's not working: $.validator.addMethod( "regex", function(value, element, regexp) { var check = false; var re = new RegExp(regexp); return this.optional(element) || re.test(value); }, "Please i...

Spring 3 MVC: Show validation message with custom validator

Hi, I need help. I am beginner in jsp, MVC. I want to validate form input with custom validator in Spring 3 MVC. My validator class package validators; import models.UserModel; import org.springframework.stereotype.Component; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; im...