validation

Better way to handle validation of core data properties before dismissing editing sheet?

What I am trying to do is improve on the "A Sheet for Creating a New Employee" example from the NSPersistentDocument Core Data Tutorial. One feature that I want to add is conditionally enabling the "Create" button only when the new object being edited by the sheet is actually valid for insertion. The problem is, how do you handle the ed...

validates_inclusion_of :in => [true, false] is allowing Strings and Fixnums

I have this validation in my model: validates_inclusion_of :imported, :in => [true, false] but still allows Strings and Fixnums. This Shoulda macro returns 2 failures: should_not_allow_values_for :imported, "blah", 42 and I've checked that the macro isn't at fault by doing this in a test: @item.imported = 42 assert [email protected] ...

What is a good pattern for interpreting Core Data validation messages and displaying them on the iPhone?

I've implemented a small proof-of-concept app using Core Data to accept some object attribute values from the user via text fields and it's all working great thanks to information found here and in the iPhone Core Data Recipes app. But I'm at the point where I need to display object validation errors to the user and I can't find a recom...

Do I really need to encode '&' as ' &' ?

I'm using an '&' symbol with HTML5 and UTF-8 in my site's <title>. Google shows the ampersand fine on its SERPs, as do all the browsers in their titles. http://validator.w3.org is giving me this: & did not start a character reference. (& probably should have been escaped as &amp;.) Do I really need to do &amp;? I'm not fussed abo...

Unique constraint with JPA and Bean Validation

I'd like to have a @Unique constraint with Bean Validation, but that is not provided by the standard. If I would use JPA's @UniqueConstraint I wouldn't have a unique validation and error reporting mechanism. Is there a way to define @Unique as a Bean Validation constraint and combine it with JPA, such that JPA creates a column with an u...

Compare array of words to a textarea input with javascript

I have a textarea inside a form. Before the form is submitted, the textarea is validated and checked so it is not empty, not over 2000 characters, not contain forbidden characters etc... I am working on the last part of the validation, which would need the textarea to be compared to an array of "bad words". This to help me maintain an...

Is it OK to return a 500 error when validation fails on ASP NET MVC using Ajax?

I have a master-detail view for adding, deleting and updating customers on an ASP NET 3.5 MVC 1.0 application. The user should be able to, for example, choose a customer from a list to be edited, and a detailed form is shown in the bottom of the page for him/her to edit the customer's data. When the user accepts the changes, the data is...

Drupal form validation marks other form fields as invalid

I have a problem with multiple forms in one page with inputs sharing the same key. I have a form in a page and another form in a block showing on the same page. Both forms have a field name exactly the key name (mail). I can't change those field's keys or I would break 2 modules. So, whenever I try to post the page form and the mail i...

Software Validation Server in Python?

I have been working on a huge project for work for a while now, and it is almost done. However, in an effort to prevent the program was being pirated (I already know there is pretty much no method that can't be cracked ), the software needs to be able to validate. I'm not exactly sure how to do this. Could some sort of software validatio...

Using variables to check for error condition in Javascript

Hi all, I have a personal simple jQuery validation script. It works when the submit button is clicked and sets up a variable: $errors = false; Then there are series of if statements that check for textbox values and conditions, and if conditions are not met, variable $errors is set to true. The script works except for one thing. If a...

Check username/email availability design question

Hi guys, I'm pretty new to programming and html design and would like to ask a question some might consider silly. Here goes: I have a registration form that is validated with jQuery validation plugin. Within this form, there is an email and password input which will be used as login credentials. What I would like to do here is che...

`A` tag is not well-formed but why?

Firebug is showing this HTML tag as "not well-formed": <a id="aHarita" target="_blank" style="margin-left: 5px;" href="http://maps.google.com/maps?q=40.879236,29.386641&amp;num=1&amp;t=h&amp;sll=40.879132,29.386962&amp;sspn=0.006295,0.006295&amp;ie=UTF8&amp;ll=40.879317,29.386641&amp;spn=0.003022,0.006947&amp;z=18" > Where is the prob...

Validation in ASP.NET User Control

I have an ASP.NET user control in which there are two fields (fromdate and todate) which have RequiredFieldValidators associated with them. When saving I want to validate if the fromdate and todate are entered. How do I do that? I have tried Page.IsValid, but it always returns true. ...

Writing proper validation errors ?

Update : Gutted entire question with more thorough description Ok same question with different names. In my model, I do validate the presence of. class QuickFact < ActiveRecord::Base belongs_to :organization validates_presence_of :quick_fact, :content But if either is blank, it errors out with : Missing template organizations/...

Validation does not work when two instances of user control exists on the view

Hi, I have created an Address user control which is as follow: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Address>" %> <div class="span-4" style="text-align: right" title="<%: GetLocalResourceObject("Type") %>"> <%: GetLocalResourceObject("Type")%> </div> <div class="span-6 last"> <%: Ht...

tfooter doesn't validate for xhtml?

Hello, I had my webpage validated for xhtml transitional till I added this table (see below). Since then it doesn't validate and says " document type does not allow element "tfoot" here <tfoot> The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- suc...

How to do ASP.NET MVC Model Validation with DataAnnotations where ViewModel contains objects from an external Web Service?

I would like to use DataAnnotations for basic client and server-side validation of my MVC ViewModels. My ViewModel looks like this: public class MyViewModel { public Client Client1 { get; set; } public Client Client2 { get; set; } public Product Product { get; set; } } So I would like to check that both client objects have...

Accessing ViewData from Partial using Steve Sanderson’s code

I have used steps in Steve Sanderson’s blog to validate the list. Now I have a problem of not able to access ViewData in my partial with this code. I set the ViewData in my action before calling AjaxViewResult but also I getting error while accessing the ViewData. Can someone tell me how to do it? ...

JQuery Validation Bug or User error?

Site in question: http://tinyurl.com/23oar6z You can look at the source for the javascript on the JQuery or the main part here: // validate signup form on keyup and submit var validator = $("#Register").validate({ rules: { UserID: { required: true, minlength: 2, remote: { ...

jQuery Validation plugin addMethod

Hi guys, I'm trying to add a new method to jQuery validation plugin with the codes below. My goal is to check whether the email address has already existed in the database(MySQL). If it is, it will inform the user to register for another email address. Somehow, the result that always returns is "Email is already taken". These are the c...