validation

duplicate entry validation in rails model

If I have a model Department with columns user_id and group_id When the action tries to save an entry into this model that already exists, i.e. 1 (user_id), 22 (group_id) already exists, at that time I want to raise a violation. What is the way to do this in rails? Following is the code I am using to save right now: if @department.sa...

Using a custom validator in a variable length list in Microsoft MVC 2 (client-side validation issues)

I have created a variable length list according to the many great posts by Steve Sanderson on how to do this in MVC 2. His blog has a lot of great tutorials. I then created a custom "requiredif" conditional validator following this overview http://blogs.msdn.com/b/simonince/archive/2010/06/11/adding-client-side-script-to-an-mvc-conditio...

Entity Validation in Sharp Architecture Repository

I have created a new 1.6 Sharp Architecture project. I have marked my only Entity with HasUniqueDomainSignatureAttribute and one string property marked DomainSignatureAttribute. I create 2 entities with the same DomainSignature and I'm able to save them both thous having duplicates. Am I missing some configuration? As I was under the ...

how to setup reset to previous session object in struts2

In my application i load data from the DB to the web form and client can edit the fields and update the data. I use reset button, if user need to reset the form with original DB data after he edit some fields. However, once user edit some fields and submit the application, if there is any validation errors(I use validation xmls) user c...

Custom Rails Validation - multiple fields simultaneously

I'm looking to create a custom validation in Rails. I need to validate that a POSTed start_date_time and end_date_time (together) do not overlap that combination in the database. Example: In the database: start_date 05/15/2000 end_date 05/30/2000 POSTed: start_date 05/10/2000 end_date 05/20/2000 FAILS! Here's the rub: ...

Checking for valid web address, regular expressions in PHP

I have this text input, and I need to check if the string is a valid web address, like http://www.example.com. How can be done with regular expressions in PHP? ...

Making validation part of application settings

I am looking for examples of configuration based validation using Validation Application Block. I've found this I want to ask if someone has an alternative solution to using EL VAB 5.0 to achieve configuration based validation. I've started with DataAnnotations but soon found out that some properties will need different types of validat...

Problems with jquery validation against spaces

I'm having a problem validating entries on a form using jQuery and the Validation plugin. The entries must be either zero or a positive number. I've had no trouble with a method to detect negative numbers (or NaNs), but I've had any method work to detect empty entries or ones with nothing but spaces. The relevant code: //WORKS //requ...

Jquery making real-time input checking

I am trying to write a script that validates user input. Like: letter length more than 5 or password and reentered-password match. But how can I get which input box in the form was clicked? I used $(function() { $('#register input').keyup(function() { if ($('#username').val().length < 5) { $('a.username').text("...

<httpRuntime requestValidationMode="2.0" /> doesn't work (using IIS 6.0)

Hi I'm getting errors with an application on our test web server, which has .NET 4.0 installed, when I input HTML into a form. I get the usual errors of: A potentially dangerous Request.Form value was detected from the client This is being caused by the change in .NET 4.0 that disables switching off automatic validation for HTML inpu...

RoR, RSpec - problem with validation testing

Through rspec (I'm using rspec-1.3.0, rspec-rails-1.3.2 gems) generator (ruby script/generate rspec_model suggestion section_id:integer user_id:integer subject:string content:text state:string type:string) I created model and model spec and run rake db:migrate and rake:test:prepare After that I started to work on my model spec: require...

Rails: how do I validate that something is a boolean?

Does rails have a validator like validates_numericality_of for boolean or do I need to roll my own? ...

Need help in epub validation in php

Hi Friend, I saw your reply regarding epub validator in some site. I am an absolute newbie in this field. Every where I got the link http://code.google.com/p/epubcheck/ , but i don't know how to use the downloaded files from there. Do you can give me a helping hand. My requirement is to how to do validate ePub file in php using same t...

How do I get the Compare Validator to work server side?

I have this compare validator: <asp:CompareValidator ID="cpvBirthDate" Type="Date" ControlToValidate="txtBirthDate" Operator="DataTypeCheck" runat="server" ErrorMessage="Please enter a valid date in this format mm-dd-yy"> <img src="Images/ExclamationMark.gif" alt="Please enter a valid date in this format mm-dd-yy" /> </asp:C...

Tried to validate my page, I have an error on my <script> tag, missing attribute?

Line 207, Column 50: Required attributes missing on element script. <script type="text/javascript" charset="utf-8"> Element-specific attributes for element script: Global attributes src async defer type charset What is it that I am missing? Thankyou Edit: This is for all of my handwritten code, I don't wa...

css validation besides jigsaw

any other css validation sites out there besides jigsaw? It's saying content:none; is incorrect but according to the specs it should be fine.. ...

Is there an EclipseLink equivalent of "hibernate.query.startup_check"?

I am using annotational entity configuration with EclipseLink/JPA and need to disable named query validation upon startup. Is there an EclipseLink equivalent property to: hibernate.query.startup_check=false ...

ASP.NET Submit but don't validate?

I have a form that looks like this : [ enterdata: [______] ; more data: [_____] ; (SUBMITBUTTON) ] [ Filter: [_______] ; (SUBMITBUTTON) ] The top half has validators. I want to be able to type into the Filter textbox and press enter to fire it's submit button - but when I press enter, it validates the top half of the form also. How ...

How to test for valid file name in Mac OS X

Anyone know how to test if a string is a valid file name in Mac OS X, other than trying to create file with that name? The issue I'm having is that sometimes, a file name can be too large. OSX has a byte limit for filenames and with unicode characters you can't just check the length of the string since they can be more than 1 byte. ...

DataAnnotations validation in Custom Model Binder

I have written a custom model binder for List in my MVC project however I am now stuck in how to get this binder to validate against my DataAnnotations validation attributes. I have found some posts on the interwebs that talk about similar scenarios, but I haven't been able to find anything that works for my particular scenario. Model...