validators

How to combine RegularExpressionValidator control and RequiredFieldValidator?

I often use regex expression validators that are also a required field. Which leads to what seems like redundant controls on the page. There is no "Required" property of the regex validator which means I need another control. Like this: <asp:TextBox ID="tbCreditCardNumber" runat="server" Width="200"></asp:TextBox> <asp:RegularExpression...

Validator not passing ErrorMessage to ValidationSummary

I have written my own Validator and although the validator appears to be working (as it does display the Text property when invalid) the ValidationSummary does not display the ErrorMessage property, or anything, when validation fails. Interestingly, it appears that it fails to even display the Text property when I add another control wi...

Should I always call Page.IsValid in ASP.NET WebForms C#?

I know to never trust user input, since undesirable input could be compromise the application's integrity in some way, be it accidental or intentional; however, is there a case for calling Page.IsValid even when no validation controls are on the page (again, I know its bad practice to be trusting user input by omitting validation)? Does ...

Do validators duplicate business logic?

I know it's possible to use validators to check data input in the presentation layer of an application (e.g. regex, required fields etc.), and to show a message and/or required marker icon. Data validation generally belongs in the business layer. How do I avoid having to maintain two sets of validations on data I am collecting? EDIT: I ...

Disable Validator but Validator Callout still shows and causes validation

I'm trying to validate that a certain increment of a product was entered in the product qty textbox that is in a repeater. The problem is that the increment is different for every product, so I need that as a variable for each call to validate it (which I don't think you can do with a custom validator), and I need it client side with a ...

Adding a variable to a ASP.NET CustomValidator

I need to have a custom validator that can in some way incorporate a custom variable when calling the client-side javascript validation. This validator is used in a repeater, and every item in the repeater needs to use the custom validator, but validating against its own variable. Is this possible and how can I do it? Example, I nee...

Required Field Validator for gridview Column

I have a gridview with a textbox template field and I have a required field validator for that textbox. The gridview contains 15 rows, with just the first enabled and the rest are not enabled . How can I make the validation appear when the save button is clicked, just on the enabled row and not for all rows? Thanks ...

Flex 3 StringValidator Highlight Field

I want to perform simple validation against multiple fields. Please note these fields are not within a mx:Form since the way they are displayed isn't the norm. The validation works properly, however, it does not highlight the textInput with the error message. myValidator.source = empName1; myValidator.property = "text"; if(myValidator.v...

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...

Validator Disappears on PostBack Inside Composite Control

This should be a simple problem to fix, as it uses the same way I fixed my last problem with FooControl (below). Basically, I want to add a derived validator I made to this composite control. It works fine but on postback it just disappears in the markup, making me think it's lost its ViewState. I am probably doing something wrong with...

on blur of asp.net form field, call validator(s) on that one field.

I have a form that has some standard asp.net validators and some custom validators. I know how to force the whole page to validate. But how on blur of a form field can i force the validator(s) that are looking at the field fire, not all validations on the page. I expect I am missing some little trick. :( ...

ASP.Net CustomValidator in a CompositeControl

I present to you a little mystery... the following control is intended to fail validation every time, no matter what, but it does not: public class Test : CompositeControl { protected override void CreateChildControls() { Controls.Clear(); CreateControlHierachy(); ClearChildViewState(); } void C...

How to Unit Test Data Annotation Validators

I'm implementing the Data Validation Validators as shown here: http://www.asp.net/learn/mvc/tutorial-39-cs.aspx This works great at runtime, but how can I Unit Test to verify if I say attribute [StringLength(10)], an error is retured? Regards. ...

Validating SOAP messages

I can't get any SOAP messages to validate as valid XML. For example, the SOAP message below I took off of Wikipedia and it failed the Validome validator (http://www.validome.org/xml/validate/). Is the validator wrong or is there a mistake in the SOAP file? If the validator is wrong can you suggest another? It should take schemas into a...

RegisterExpandoAttribute with Update Panels

I am having some issues with a custom validator that I have setup. The validator is now in a control which is in an update panel, in another control, in a page. The first time the page loads the validator works perfectly, after a partial update (in the update panel), the validation will not work. The problem is that the my RegisterExp...

Display a custom error message in asp.net ?

Hi all.. Using asp.net validators, I'd like a control similar to the validation summary, except that it should only have 2 states: Hidden or showing a static message. When the page is valid, it should be hidded, and when it's not it should be showing the message :) Is this possible using the built-in controls of asp.net? (Bear in mind...

PHP: Split a string in to an array foreach char.

Hi I am making a method so your password needs at least one captial and one symbol or number. I was thinking of splitting the string in to lose chars and then use preggmatch to count if it contains one capital and symbol/number. however i did something like this in action script but can't figure out how this is called in php. i cant f...

another Bug in jquery validator?

i use remote method of validator for checking if username exists in DB my scenario: form with one field (username of course) i filled field it passes validation, but i don't sending form yet going to DB inserting username that i filled in form that i still don't sent yet returning to my form press on submit btn voila, it pass validat...

Client side event handler on validation for asp.net validator controls

Hi, I have an asp.net form with bunch of sections that can be expanded/collapsed and are normally collapsed. Now, most controls on the form have RequiredFieldValidator or some other validators attached. If the user tries to submit the form with required fields not filled out, for m is not submitted but because most sections are normally...

How to force page validation on Page_load.

I have a situation where i need the validators to fire on a page when it is loaded. But when i run Page.Validate(); the validators are not fired. I here this is because you cant do validation this early. Is there away around this? ...