validation

Validating several textboxes on a C# windows form at the same time

Hi, I have a form with several textboxes and other controls. I'm using the errorprovider control and I wired the validating event on each textbox that I need to validate. The Validating event occurs when a control yields focus to another control. So the event occurs when you use the tab key to move away from the current control or when ...

What's an appropriate HTTP status code to return by a REST API service for a validation failure?

I'm currently returning 401 Unauthorized whenever I encounter a validation failure in my Django/Piston based REST API application. Having had a look at the HTTP Status Code Registry I'm not convinced that this is an appropriate code for a validation failure, what do y'all recommend? 400 Bad Request 401 Unauthorized 403 ...

ASP.NET MVC 2 RC Validation problem

I am trying to use the validation capability of ASP.NET MVC 2 (RC) I have a viewmodel public class CategoryPageViewModel { public int Id { get; set; } [Required(ErrorMessage="Category name required")] public string CategoryName { get; set; } } action [HttpPost()] public Action...

How to validate user input in RoR?

I know that the RoR can do the validation in the models. But I want to confirm the user's password in the views. I means, it show two textfield for user to type password twice to ensure the user type the password correct, but in the database I only store one value. How can I handle it in the RoR? ...

Comparing 2 elements of a 3x3 matrix to see if element 2 is adjacent to element 1.

Basically, I'm creating a puzzle where you can swap pieces. And I want to make sure that when swapping 2 elements, the selection is valid. Since the puzzle is only 9 pieces (3x3), I am currently using the code: function valid_selection(p1, p2) { if (p1 == 1 && (p2 == 2 || p2 == 4)) return true; if (p1 == 2 && (p2 == 1 || p2 == ...

How do you disabled a button while a form doesn't validate with jQuery validate?

Hello, I was wondering how you can disable button (not submit) with jQuery while a form doesn't validate with jQuery validate, but when it does validate, enabled the button. ...

how would you regex validate a string of mobile numbers?

i need to validate this type of string 0415256987, 0452 654 987, 0411 236589, 0 410 258 987 etc. each number has 10 digits and spaces commas, new line, are allowed. in my project this is a textarea where users enter comma delimited string of mobile numbers. the regex is for the js validation. the spaces and new lines are allowed to...

.NET xhtml validator library - offline

Hi, do you know about any XHTML validation library for .NET? I found that it's possible to use W3C API. But the problem I have is that I need to validate passwords protected pages or page on local server. All libraries I found are using URL as parameter for W3C validator. Do you know about any library? ...

validate radio buttons server side

what goes in the code behind for the Server Validate event of a Custom Validator, which is attempting to validate a set of 2 radiobuttons? ...

Cross field validation with Hibernate Validator (JSR 303)

Is there an implementation of (or third-party implementation for) cross field validation in Hibernate Validator 4.x? If not, what is the cleanest way to implement a cross field validator? As an example, how can you use the API to validate two bean properties are equal (such as validating a password field matches the password verify fiel...

php validation using jquery and ajax

Hi, i have a jquery ajax form. i have validation at server side for repeated username and email ID. which works fine without jquery/ajax. in my php code i have used die() to return if any error occurs. my main problem is at ajax here is the code $(document).ready(function(){ $("form#regist").submit(function() { var str = $("#regi...

Expose ContentPlaceHolder in User Control

Hi, I am implementing a web application and i faced the following problem: I have a User control with it's own styles and js files, when i add the user control to the page and i try to validate the murkup i get error due to the fact that the user control's styles and js are in the body of the page in stead of the head. i would like to ...

Presenting xml validation errors

Hi people! I'm trying to do this: I have an XML file that I want to validate according to an XSD file. So far so god... What I have to do is present the all node where is the validation error. For example I have this XML file : <people> <name>Jonh</name> <tel>91991919199191919</tel> </people> When I validate this file, this w...

How to set some field in model as readonly when a condition is met?

I have models like this: class Person has_many :phones ... end class Phone belongs_to :person end I want to forbid changing phones associated to person when some condition is met. Forbidden field is set to disabled in html form. When I added a custom validation to check it, it caused save error even when phone doesn't change. I...

Validate an XML file as a build event

I was wondering if there was a way to validate XML files as part of a pre-build event, so that I can go back and fix the problem before the app starts up. I'm aware of (and use) code to validate XML files on application startup as part of serialization (XmlReaderSettings with ValidationEventHandler), but I'd like some way of validating ...

PartialView Validation

I am having this issue where I have a form in a partialview but when validating it jumps out of the parent view and appears on its own (having the submit action url). Also I tried with Render.Action, where validation does not fire at all. I am using ASP.NET MVC 2 RC and need the server-side validation to work, using the built in valida...

Html.Textbox validation CSS not Applied

Hello all, Thank you in advance for any help. I am having an issue on 2 of my websites that I have created. I have Html.TextBox 's on the page that need to be filled out and I have validation working so that the validation message shows up when they are empty. My issue is with the CSS for the TextBox itself. For some reason the text...

ASP.NET MVC. Validation fails on dropdown no matter the value.

I've got a form with a dropdownlist in my MVC app. Now that I'm trying to add validation to the mix it seems that a dropdownlist fails validation no matter what it's value is. Without the validation it will allow the controller to work and redirect as planned. With the validation it does seem to allow the database changes to occur but M...

Rails greater_than model validation against model attribute

I've got a Trip model, which among other attributes has a start_odometer and end_odometer value. In my model, i'd like to validate that the end odometer is larger than the starting odometer. The end odometer can also be blank because the trip may not have finished yet. However, I can't figure out how to compare one attribute to another...

trigger jquery validate() on button click

i have from and i am using jquery validate jquery.validate.pack.js its work fine when i press submit button, i just add following code $(document).ready(function(){ $("#contactform").validate(); }); and class="validate" for text box but i want to call php file with Ajax after validate ...