validation

Design pattern for validating input?

What is the best way to validate input? For argument's sake, if the input is invalid, the user would like a message explaining why. Here is what I can come up with. Validator method: Pass input to the validator, which returns true if the input is valid. Otherwise, the validator either returns false (or an error code) and lets the call...

What are methods of form validation from inside a shadowbox?

Ok I have a form inside a shadowbox, this thing will just not validate... I have tried it a million different ways. It also lives inside a Wordpress Theme which I don't think is breaking it. Jquery is loaded in the header. the form is pasted into a gist: http://gist.github.com/578270 Any ideas? Thanks so much, feel like I am banging...

JQuery Validate using addClassRules: What am I missing?

I've put together a snippet of code in ASP.NET MVC in which I'm trying to use the addClassRules methods of jQuery's validator. From what I can tell I'm taking this straight of the examples on http://docs.jquery.com/Plugins/Validation/Reference But the page is just submitted it doesn't show any errors. I would like to use the "addClas...

How to require FileUpload with actual upload, not just selecting a file

I have a FileUpload control along with a required field validator. It throws an error if the user doesn't click the Browse button to select a file (which is correct). However, if the user clicks the Browse button, but doesn't click the Upload button, ASP.NET's required validator doesn't throw an error. Any ideas how to fix? ...

Validating textbox values

I have three textboxes: Textbox1, Textbox2, Textbox3 I have to check if any of the values are same in all the three. ex: I have 1 as value in one textbox. I cannot have 1 in the other two textboxes. I am using the textboxes to input ids. If I enter duplicate id's (for example I enter 1 in Textbox1 and Textbox2 / Textbox3 ), the progr...

Silverlight DataGrid - Validating New Rows When Have Not Edited Individual Cell

I have a silverlight datagrid. Validation works very well using DataAnnotations. However if I add a new row to the grid I don't get validation kicking in until I actuall try and edit cells. Is there no way to force the grid to validate when a cell has not been clicked on? ...

How to validate the captcha taking the user to another page ?

IF we want to display the captcha in a different centralized page and after getting response from that site we can validate the page. ...

Regular expression for checking the range of numeric values

I want to have a range between 0 to 65536 , what would be the regular expression for that? ...

Validation with nested ViewModels in ASP.NET MVC2

I'm having a weird (at least to me) problem with validation using ViewModels and Html.EditorFor(T). The validation errors produced by <%: Html.ValidationSummary(false) %> lists properties which are not invalid, and do not correspond to the values in the ModelState dictionary when I view it in debug. I'm using strongly typed view models c...

What is the difference of using asp.net validator controls vs JQuery for front end validation.

Hi, Could you please tell me the difference between using asp.net validator controls vs JQuery for front end validation? What happens if the user turns off javascript on their browser? Thank you.. ...

jquery ajax and php validation

hi! I got this kind of form validation: php side: if ( trim($message)=="" ) { echo "lalalaal<br>lalalalala"; } then in the onsuccess ajax jquery: var error=$('div#error_contact').html() switch(error){ case "lalalaal<br>lalalalala": $("#form_contact").slideUp() } if i put a <br> the string equality is not verifie...

How to validate a complete and valid url using Regex

I have a URL validation method which works pretty well except that this url passes: "http://". I would like to ensure that the user has entered a complete url like: "http://www.stackoverflow.com". Here is the pattern I'm currently using: "^(https?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //user@ + @"(([0-9]{1,...

How to show validation errors from an associated model in Rails?

I have 3 models: User, Swatch + Color. A user has many swatches, and a swatch references a color. Users create swatches on their profile page (users/show/id). The color model handles validation through the swatch model with accepts_nested_attributes_for :color and validates_associated :color. My question is, how to show the color-spec...

Rails/Active Record FAILSAFE error "User can't be referred"

Using Rails 2.3.2 (not in a good situation to upgrade at the moment) with ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]. Getting the following error when trying to save when doing validations on the model, if the validations are :on => :update. If I change the validations to :on => :create and create a new record, I don't...

[Required] attribute dependent on another field

Hi, In a model of my ASP.NET MVC application I would like validate a textbox as required only if a specific checkbox is checked. Something like public bool retired {get, set}; [RequiredIf("retired",true)] public string retirementAge {get, set}; How can I do that? Thank you. ...

JQuery Validate: How do I add validation which checks the sum of multiple fields?

I'm trying to use jQuery validation for a dynamic form I'm setting up. In some cases this form contains a set of input boxes which are suppose to total 100. An example might be: Please indicate what percentage of students are in each grade? Grade 9: TextBox1 Grade 10: TextBox2 Grade 11: TextBox3 Grade 12: TextBox4 I want to veri...

can i validate xhtml programmtically from a php script?

I would like to have a PHP function to check if a URL returns valid HTML or NOT, and returns true or false. Something like: if (validate_page("/somefile.html")) { echo "This page validated!!"; } I found TWINE but it doesn't just give me true or false. Also I got an error running it on my system. http://twineproject.sourceforge.net/ I...

Form Validation using Jquery

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <title>Validation POC</title> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="Scripts/jquery.validate.js" type=...

Page Validation, Submit Button is not part of the usercontrol

Hi, I have some fields to be validated on the server (CustomValidator) which is in a separate user control and my Submit button is in the page not in the user control. What I have done is, I placed all my Validation Methods in the code behind of my usercontrol (ascx.cs) and the page validation is in the code behind of the page (aspx.cs)...

Javascript Validation Syntax Errors

Hi guys, I have this piece of javascript which is supposed to validate on the clientside. I created it using this tutorial: http://www.php-mysql-tutorial.com/wikis/php-tutorial/form-validation-using-php.aspx Unfortunately I'm getting this warning: "There is a syntax error on line 48. Code hinting may not work until you fix this error...