validation

RegularExpressionValidator not firing on white-space entry

I want to validate string containing only numbers. Easy validation? I added RegularExpressionValidator, with ValidationExpression="/d+". Looks okay - but nothing validated when only space is entered! Even many spaces are validated okay. I don't need this to be mandatory. I can trim on server, but cannot regular expression do everyt...

Can somone help me understand this tutorial better?

Hi I am trying to go through this tutorial tutorial . This tutorial seems to do everything that I been looking for but I am having trouble trying to understand it. Maybe it is because I don't know enough of Xval, jquery.validate. 1st He seems to be using a typed view: RemoteValidation.Models.User. What happens if I want to pass some ...

Using Required Field Validator to Disable ListBox

Hi all, Pretty simple question. I have a few ASP RequiredFieldValdators checking some text boxes. Out of the box, it checks validation when a button is pressed, basically disabling it unless all fields are met. I also have a listbox with a bunch of data points, which load new data into the text boxes that are being validated. I want...

jQuery Validation Plugin Checkbox errorPlacement

I have a group of checkboxes that all have the same name. They all have different values. They are just part of a form. They do not make up the entire form. I want the checkboxes to display their error AFTER the last checkbox of that group. is it possible to do something like this in jQuery? $("#myform").validate({ errorPlacement: fu...

Seam Richfaces form validation

Hi all, My form validation works great, but the messages use the JSF component name and not the field label. For instance, I have a field subject and the error message I get when it is empty is something along the lines of: UIComponent:contactBean.firstName cannot be empty. My Form: <div class="field"> <s:decorate id="firstNameDecor...

How to use validator in this case is ASP.NET?

I have two input text box, which are decimal. The sum of this two input cannot more than 100. When input1 enter 40, input2 cannot more than 60. I need to do all the thing in client side and need to allow client to enter any value. But if the entered value more than the limit, I need to show the validator error message and so Page.isVali...

Positive number validation in jquery

I have use an expression for validating positive number ^\d*.{0,1}\d+$ when i give input -23 then it check it is negetive but when i give input +23 then showing invalid number. what is the problem ???? any one can give a solution that With +23 it will return (positive) ...

WPF Validation in an ElementHost control

I've got a WinForms form that contains an ElementHost control (which contains a WPF UserControl) and a Save button. In the WPF UserControl I've got a text box with some validation on it. Something like this... <TextBox Name="txtSomething" ToolTip="{Binding ElementName=txtSomething, Path=(Validation.Errors).[0].ErrorContent}"> <Bind...

How to validate characters ONLY in ColdFusion CFForm?

I've got a very simple cfform with a single form field: <cfform action="asdf.cfm" method="post"> <cfinput name="fieldName" type="text" size="20" maxlength="20" required="yes" validate="regex" pattern="[A-Za-z]" message="Only characters are allowed." /> <input type="submit" name="btnSubmit" value="check" /> </cfform> Theoretically,...

Validation: do it in the class, or in the database?

I'm playing with LINQ-To-SQL in .NET 3.5 and have built some classes based on an underlying database. I now face the decision: do I validate data in the class code, or in the database? I can see pros and cons either way. If I do validation in the database, the validation takes place no matter what app is using the database. (I currently...

Validate an XML file against local DTD file with Java

How can I validate an XML file against a DTD that is stored locally as a file? The XML file does not have any DOCTYPE declaration (or may have one that should then be overridden). I had a look at this thread but besides the fact they are using .NET I doubt that this is a good solution. Any input appreciated! ...

Is there a better way to determine if a string can be an integer other than try/catch?

I needed a function that simply checks if a string can be converted to a valid integer (for form validation). After searching around, I ended up using a function I had from 2002 which works using C#1 (below). However, it just seems to me that although the code below works, it is a misuse of try/catch to use it not to catch an error but...

RegularExpressionValidator for multiple emails.

I'm validating a textbox for valid email with this: <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtMailCustom" Text="Invalid address" ValidationExpression="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9] {1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" runat="server" /> No...

ASP.NET Validation

i have one page to design. in this it includes an , password text box, My requirment is that when an user hit the submit button without entering any data, then it shows a message in red color at side of both the text box as "Cannot be empty" How it can be done without using Javascript? ...

How do I add an ASP.NET control inside an ASCX to an external RequiredFieldValidator programmatically?

I have a drop-down list inside a user control (ASCX) that I want to validate from the page on which I've placed the ASCX, but when I set the ControlToValidate to the drop-down list the page complains that it can't be found. Thanks for any help/suggestions. ...

Validate Contact Form

I have a simple contact form with Subject and Message that I want to validate to prevent blank e-mails. ActionMailer doesn't support validation. Where should I put it (i.e. in a separated model or directly in controller)? UPDATE: what is the best way to implement validation in a non ActiveRecord model? ...

Check for Valid HTML link with SESSIONS

One of the first things I like to do when I make a site is to put in links at the bottom of the page to check for valid HTML and CSS: HTML5  •   CSS <div> <a href="http://validator.w3.org/check?uri=referer"&gt;HTML5&lt;/a&gt; <a href="http://jigsaw.w3.org/css-validator/check/referer/"&gt;CSS&lt;/a&gt; </div> However, when you...

Separation of ORM and validation

Hi all, I use django and I wonder in what cases where model validation should go. There are at least two variants: Validate in the model's save method and to raise IntegrityError or another exception if business rules were violated Validate data using forms and built-in clean_* facilities From one point of view, answer is obvious: o...

Page`_IsValid is set to true if OnClientClick is set

I wrote a UserControl that attaches a Javascript function to a form's submit button. The Javascript function ensures that the page is valid by calling Page_IsValid and then proceeds to execute some code. For the problematic pages, the Page_IsValid is set to true on first load. If I don't set the OnClientClick, Page_IsValid is correctly...

I need a regex that validates for minimum 7 digits in the given string.

Hi I wanna validate a phone number. My condition is that I want mimimum 7 numbers in the given string, ignoring separators, X, parantheses. Actually I want to achieve this function in regex: Func<string, bool> Validate = s => s.ToCharArray().Where(char.IsDigit).Count() >= 7; Func<string, bool> RegexValidate = s => System.Text.RegularE...