validation

Is there an all-countries phone number validator for Perl?

I am doing web development with Perl. I need to do phone number validation for all countries. Is there open source Perl module that can do the following? For example: country = Malaysia, if user input phone number = +60127008007, after validate, it return this is a valid mobile number in Malaysia, where: In local Malaysia, we call: 0127...

Mixing Asp.net default validation with a custum submit action

I have a page whose submit buttton does dot submit at all. It rathers has a some javascript in OnClientClick that employs some logic and redirects the user to a calculated URL. The thing is I want to use ASP.net default validation in this setup. I need to be able to query the state of the client side validation in the javascript. How do ...

What is the best approach for confirming html form fields?

A lot of times you get a form where you need to enter an email address (or other form field) twice in order to confirm that you typed it correctly the first time. Some forms disable the copy and paste action (via javascript) in the browser to force the user to type the email address again. Personally I find this highly annoying. What a...

Validation, what checks do you typically perform in your web apps?

I'm building a publicly available web app. Because of this, I'll be validating every field as exhaustively as I can. I mean, if someone enters something that isn't valid, they will know exactly what it was (making it clear what they need to fix). I've followed Scott Guthrie's examples in the NerdDinner eBook. I love the idea of having a...

ASP.NET SiteMap control invalid XHTML -title contains &

Hi all, I'm using the .SiteMap file and Sitemap control to create a sitemap on a page. The title of the page in the Web.sitemap is: "Out & About". When the page renders, the ampersand is shown as an & (Out & About) in the source, this obviously then causes validation errors. Any ideas how I can force good ol' .net sitemap to encode t...

Validating Class Data

In my app, I am creating a series of validation classes to check, for example, that a user entered Name property of the class (from a WinForm) doesn't exceed the size of the varchar() in the database. Currently, the validation code will throw a custom Exception if the Name field is too large. (The custom exception, when caught by the UI...

Ruby on Rails ActiveRecord conditional validation (and more..)

I have a Product model which validates multiple attributes (including a Paperclip image attachment) like so: validates_presence_of :name validates_format_of :name, :with => /^([a-zA-Z0-9\ \-]{3,128})$/i ... has_attached_file :image validates_attachment_presence :image validates_attachment_content_type :image, :content_type => ["image/j...

ASP.Net FileUpload Control with Regex Validator postback problem

I'm trying to use a .Net FileUpload control along with a Regex Validator to limit filename to JPG, GIF, or PNG extensions. After postback, the filename is gone from the control (as expected), but this seems to cause the validator to fire and display its error text. Can anyone suggest a fix, or a better way? Thank you! ...

Should validation be done in Form objects, or the model?

This question is mainly geared towards Zend in PHP, although it certainly applies to other languages and frameworks, so I welcome everyone's opinion. I've only recently been using the Zend framework, and while it's not perfect, I have had a pretty good time with it. One thing that drives me crazy, however, is that most of the examples ...

Where do you store validation logic?

I'm playing around with the MVC.Validation Toolkit. The goal is to use the same validation rules in client script and in the server code. However i keep making new poco classes for everything. I have one class from linq2entities, then I got one class that is passed from the datalayer to the business layer, then to the controller. And I ...

.Net Winforms Tell if Exit button was pressed

I'm using some controls that trap validation when anything happens--including when users press the exit button. Is there a way to tell if the exit button was pressed? ...

ASP.NET MVC Client Validation with jQuery using Html.ValidationMessage?

I am trying to tap into the HTML.ValidationMessage() element to write so really custom client side validation with jQuery. Is this even possible? My server side validation is displayed using the HTML.ValidationMessage(), and I am wondering how I would access that element to display a custom message using jQuery before a form submit. I...

Validation Message

I have a problem with setting validation message. i have two Model in one control and both Model have same property "amount". So setting validation for one Model.amount will reflect to other Model.amount as well. I have tried to pass different ids to both but not working. <%= Html.TextBox("amount", Model.amount, new { id = "Pamount" }...

ASP.NET: How to change the background color of a control that failed validation?

Let's take the following simple site as an example: <asp:TextBox id="TextBox1" runat="server"></asp:TextBox> &nbsp; <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="Required!" ControlToValidate="TextBox1"> </asp:RequiredFieldValidator> Now, I would want the TextBox1 to change its BackColor to ...

Zend Framework form with jquery

Any one a idea how to simply create a form with Zend_Form and jquery? I want to use Zend_Form to validate the form so I don't have to dual script the form in JavaScript and PHP. Thank you, Ivo Trompert ...

How can I load a config file from different assembly in asp.net?

Hi I am using the Validation Application Block form the Enterprise Lib, and have my validation rules defined in a validation.config that is located in the same assembly as the entity objects (so I can use the same rules in both the backend and on the website). But how do I get the validation.config from the entity assembly into the web...

Required Field Validator, displaying on initial page load

I have a simple textbox with a required field validation control attached to end and then being displayed in a validation summary at that bottom of the page. Everything works great on it but the validation seems to fire on the page's initial load which obviously sets off the required validation and displays the error message. How do ...

Passing information back from a UserControl

I am just getting to grips with the concept of a UserControl. I've created a UserControl to group together a number of controls that were being duplicated on individual pages of a TabControl. Some of these controls are text fields that require validation, and when validation is unsuccessful I need to display an error message. However t...

jQuery Validation - Require answer to all questions or opt out of survey

We have a registration form that asks for demographic information with the additional option to not provide any information. However, to keep our numbers adding up properly, we want to require you to enter all information if you select any demographics. A rendering of the form: Gender ( ) Male ( ) Female Disabilities? ( ) Yes ( ) ...

One XML Schema for Multiple but similar XML files

How can I create one XML Schema that will work with multiple but similar XML files. For instance, for a Food Recipes website I have a recipe XML called 'dessert' another 'indian' and another 'vegetarian', they are all pretty much the same, the only thing that changes is the root element. Here's an example of a file: <?xml version="1.0" ...