validation

Kohana3 validation on fields with []

Hi! I have a form that contains checkboxes. <input type="checkbox" name="question[5][13]" value="1" /> Now, I want to use the Kohana validation class, but it seems like it does not validate fields that are array... had anyone ever worked something around? I have something like this, but it will not work: $rules->rule('question[5][13...

struts 2 validation don't work, why?

I implemented some actions in a Struts2+J2EE environment. I'd like to validate inputs with the struts validation framework: my package extends struts-default, my action extends Action Support and I put the xml file (MyActionClassName-validations.xml) in the same folder of my action. It doesn't work! Could I do something to check if valid...

Possible to get the CompareValidator to accept numbers with commas?

I had been doing a type check for Double for an input field on a web page but now I need to allow commas. Can this be done using a CompareValidator or do I need to use a regex validator? ...

MVC 2 Validation Attribute Unit Testing Using IoC

I am currently writing some unit tests for an ASP.NET MVC 2 controller and having some issues with the MVC 2.0 validation attributes. The validation attribute in question uses a repository to check that no duplicate names exist in the current data source, and I would like to replace this repository with a fake one during my unit test. I ...

Alternative validation of two sets of controls using single submit button in ASP.NET

On an ASP.NET page, I am using the same form for login and registration. There are two login fields and seven registration fields. Something like this: txtUsername | txtPassword txtNewUsername | txtNewPassword | txtNewPasswordRepeat | txtFirstName | txtLastName | txtPhone | txtEmail btnSubmit In each case, all the fields are com...

Data Annotations for a subset of properties

I've been reading up on Data Annotations (i.e. Scott Guthrie's blog post) and I am thrilled about the concept of having validation logic in one place. Has anyone been able to use this technique successfully when prompting the user to enter a subset of the properties associated with a given class? For example (pseudocode)... public c...

asp.net mvc 2 client side validation missing ValidationRules on custom attribute

Hi all, Can't seem to get checkbox to be validate on client-side using asp.net mvc 2. Here is my code. Model [Serializable] public class RegistrationModel { bool termsAndCondition = false; [RequiredToBeTrue(ErrorMessage = "Need terms and service")] public bool TermsAndConditions { get { re...

advice on architecting asp.net mvc applications

I've been using ASP.net MVC for about two years now and I'm still learning the best way to structure an application. I wanted to throw out these ideas that I've gathered and see if they are "acceptable" ways in the community to design MVC applications. Here is my basic layout: DataAccess Project - Contains all repository classes, LIN...

Need to turn Rails 3 functionality into Rails 2.3.8 functionality.

I have this Rails 3 functionality: http://pastie.org/1131667 and I need to get that turned into Rails 2.3.8.... Can anyone help? Basically I need a custom validation function wherein I can access data members' values at runtime. Many thanks! ...

ASP.NET MVC 2 validation for variable length or dynamic data views, and view models

OK, so maybe I am really missing something here, but how is it so difficult to do effective server & client side validation in MVC (2)? Here are a few examples: I want to use a variable length list. I follow a great tutorial like Steve Sanderson's variable length list overview. I want to create a custom validator like "RequiredIf". My ...

Allow user to input HTML in asp.net MVC

How can I allow a user to input HTML into a particular field using ASP.net MVC. I have a long form with many fields that get mapped to this complex object in the controller. I would like to make one field (the description) allow HTML which I will preform my own sanitation on at a later point. ...

Are Microsoft Code Contracts unsuitable for validating user input?

I've seen it written elsewhere on SO that while the Enterprise Library Validation Application Block is geared towards validating user inputs, Code Contracts are meant to prevent programmer errors. Would you support this opinion? Why? ...

html javascript type=file

With a html type=file, how can I validate to determine if a file was uploaded, (for client side validation using javascript or jquery) <form action="program" enctype="multipart/form-data" method="post"> <input type="text" name="textline" size="30"> <input type="file" name="datafile"> <input type="submit" value="Send"> </form> <script> ...

How do I disable validation of Javascript in <script> tags in JSPs ...in Eclipse

I'm using JSTL to generate a JavaScript object in a bit of inline script in a JSP, like this: <script> var data = [ <c:forEach items="${MyData}" var="Datum" varStatus="status"> { foo: ${Datum.foo}, bar: '${Datum.bar}', }<c:if test="${not status.last}">,</c:if> </c:forEach> ...

Java library to validate postal addresses entered by users in App Engine app?

At first I thought the com.google.appengine.api.datastore.PostalAddress class was going to provide some way of validating addresses entered by users in an App Engine app but I don't even know how to instantiate this class - it doesn't have a public constructor. Is there a Java library that could be used in an App Engine app to validate...

Rails Nested Attributes and Custom Validation

I'm fairly new to both Ruby and Rails (using 2.3.8), so forgive me if I'm missing something really obvious here but I've been struggling with this for a while and my searches have been fruitless. In my code I have Plans, and a Plan has many Plan_Steps. Each Plan_Step has a number (to indicate '1st', '2nd', etc). I have a form to update ...

how to prevent using space while typing?

hello all.i have one textfield for input some serial number code.i want set this code show alert if someone use spase. it means space is not allowed and just allowed use minus for separate this code. Are you have any idea for resolve this problem? can i use jquery validate? the correct typing: 135x0001-135x0100 ...

Bassistance Validation not working correctly with jqTransform

Hi, I'm using jqTransform to style my forms which works very well. However, when I add Bassistance's Validation plugin, the validation error messages are shown within the jqTransformwrapper divs (i.e. inside the textbox) instead of the parent element (after input). So the DOM shows this: <label for="firstname">Firstname</label> <div c...

Error found in xHTML output due to PHP's variables, $_SERVER and <ADDRESS>

I'm having this problem with validating a document that contains some basic PHP variables. Mainly I'm using html's h1, h2, and pre codes for formatting the text. My problem is that when I validate the document, it comes out with an error. The problem area is this part of the file: <h2>Server Info</h2> <pre> <?php echo $_SERVER; prin...

What ways can I ensure that a string property is of a particular length?

I've created some classes that will be used to provide data to stored procedures in my database. The varchar parameters in the stored procs have length specifications (e.g. varchar(6) and I'd like to validate the length of all string properties before passing them on to the stored procedures. Is there a simple, declarative way to do th...