validation

How to validate required text when "Other" option is selected from a dropdownlist?

Hi, I have the following on my website. Source [DropDownList] Website Search Engine Other Other Source [TextBox] I want to use the ASP.Net validators (I think the compare validator) so that when "Other" is selected in the dropdownlist and no text is entered the validation is triggered and the page cannot be submitted. Is this pos...

Regular expression for URL validation (in JavaScript)

Does someone have a regex for validating urls (NOT for finding them inside a text passage)? JavaScript snippet would be preferred. ...

How do I properly validate posted numeric values in asp.net mvc?

In an asp.net mvc web app I want to display a custom message for invalid model values. The issue I'm running into is with numeric properties. A user can put a string into a textbox that is bound to a decimal property and click submit. Since the asp.net mvc model binder cannot bind the string value to the decimal property on my object,...

suggest any Asp.net control for adding date of birth by specify day,month & year in each dropdown control

Suggest any Asp.net control for adding date of birth by specifying day,month & year in each dropdown control & its validation ...

CustomValidator, pagemethods and JQuery what fun

Hey all, I have a CustomValidator, RequiredFieldValidator and ValidationSummary controls on an aspx page to check the current password and make sure the new password is not blank. When I click submit I get the js alert() box from the summary control telling me about just the RequiredFieldValidator being false, but the client script for...

ASP.NET web application - Serverside validation of form field’s data

Hi, We are building an ASP.NET application with C#.net as language. Here we are validating the form field’s data at client side using ASP.NET validation controls. Now we are planning to validate the form field’s data at the server side too, to avoid script injections by hackers. Would you please guide me on this, if you have an idea? ...

What is a good approach on dealing with repetitive and lengthy validation codes?

I have only recently started web programming and I am pretty much amazed that although I am using a validation library, I still get 20-30 lines of code for validation alone, not counting error messages and callback functions. I am using the Kohana MVC framework and I was wondering if there was any way I can shorten my validation codes. I...

Validation with ASP.NET MVC Linq To SQL: how do I avoid editing a generated source?

I'm reading several docs on validation in ASP.NET MVC. Ignoring those that suggest to reinvent the wheel writing your own validation logic, most articles advocate the use of xVal or Data Annotation Validators, both of which allow declarative validation through decorating models' properties(*). I think I'll go for xVal, as it seems to be...

Invoke Javascript on ValidationSummary ShowSummary

Hello, I am trying to invoke a javascript function when a ValidationSummary shows the errors on a page. Is this possible? ...

XML validation error

I'm trying to validate the following XML but I'm unable to, can you please spot the error? <!-- menu: its a menu --> <menu id="Welcome"> <!--audio: file to play --> <audio src="D:\Telephony\VOXs\Welcome.vox" /> </menu> <!-- form: its a menu --> <menu id="LanguageSelection"> <audio src="D:\Telephony\VOXs\LanguageSelection.vo...

Validate uniqueness of many to many association in Rails

Say I have Project, that is in many-to-many association with Tag. I'm using *has_many through* so I have separate join model. How do I create validation, that checks uniqueness of join model? Now I have only has_many :tags, :through => :taggings, :uniq => true But that doesn't validate on save. ...

Validate the quantity of associated objects

Given this: class User < ActiveRecord::Base has_many :photos MAX_PHOTOS = 5 validate :quantity_of_photos def quantity_of_photos ??? end end And this: @user.photos.size # => 5 I need this to fail: @user.photos << Photo.create(valid_photo_attributes) How do I do this validation? ...

.input-validation-error class not added to input in view

Hi Everyone, I am trying to add some simple validation to my asp.net mvc form and am having trouble getting the .input-validation-error class to be added to my inputs. The validation-summary-errors and .field-validation-error work fine. Thanks in advance for your help! Edit: Thanks for everyone's help!!! I had to add this line to t...

PHP PEAR Quickform validation help

I am using PEAR's Quickform package to validate a form I have, I need help getting a validation rule applied to a group of checkboxes. $subjectArea[] = HTML_QuickForm::createElement('advcheckbox', 'SubjectArea', null, 'Student', 'id="subjectareastudent"', 'Student'); $subjectArea[] = HTML_QuickForm::createElement('advcheckbox', 'Subject...

parsing SQLException errors in an ASP.NET (MVC) application?

While validation can prevent most SQL errors, there are situations that simply cannot be prevented. I can think of two of them: uniqueness of some column and wrong foreign key: validation cannot be effective as the an object can be created or deleted by other parties just after validation and before db insertion. So there are (at least) ...

How to validate a percentage to two decimal places with a Regex?

Is there a regex that would validate a percentage value to 2 decimal places? I have a regex for two decimal places, but don't know how to stop values above 100. e.g. 100.01 is validated with my regex. ...

CustomValidator problems within ASP.NET

EDIT Fixed the problem - I needed to add the validators to a ValidationGroup and then call each of the validation controls Validate() method on the submit behaviour of the button. protected void btnDone_Click(object sender, EventArgs e) { this.cvValidation.Validate(); this.revYear.Validate(); if (Page.Is...

what is a good approach in dealing with remote captcha validation in jquery?

I am using Kohana's Captcha library which generates the captcha image. I am using jquery to validate the captcha. The problem is when I enter a wrong text in to match the image against, the captcha library seems to be generating another captcha image but won't output it in my current form. The validation is remotely done by calling a con...

MySQL field values, can a float be defined beyond digit count?

Three questions, all basically the same: So my table has a field, and it's data type is float. There are only 64 possible values, however, ranging from 0.25 to 16.0 (increments of 0.25), and I'd like to only allow those values as an extra layer of validation. Can I set the field to be greater than zero? Can I set a minimum and maximum...

Add validation to a dropdownlist

In my .aspx page, I have a dropdown list. The first value that it defaults to is 'please choose', and it has the value of -1. How can I add validation to it so someone chooses an item? ...