hi all
I have been trying to do this for ages and can seem to grasp it. hope someone can help ?
i have a 'message' model that has many through 'distribute' relationship to a 'contact_detail' model.
basically a message can have many contacts associated with it and a contact can have many messages.
I can get this to work and save it ...
In an ActiveRecord model, is it considered best practice/necessary to use validates_presence_of when also using validates_length_of?
For example:
class Company < ActiveRecord::Base
validates_presence_of :name
validates_length_of :name, :in => 5..30
end
To me, it seems redundant. Having a length between 5 and 30 means that the a...
Hi
If I put a large text box which has has a data binding validation error into a ScrollViewer, the red border which is shown around the text box only includes its visible parts as if it would not be scrolled.
Example:
Window1.xaml:
<Window x:Class="ErrorTemplateApplication.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/...
What approaches do people take (if any) in managing guard clause explosion in your classes? For example:
public void SomeMethod<T>(string var1, IEnumerable<T> items, int count)
{
if (string.IsNullOrEmpty(var1))
{
throw new ArgumentNullException("var1");
}
if (items == null)
{
throw new ArgumentNullEx...
I followed a blog post here to use a custom validator to validate a list of emails. However, the Regex expression in the article:
Regex emailRegEx = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*",
RegexOptions.IgnoreCase);
allows this email address through:
"[email protected] [email protected]"
which is ...
I get the following warning in a ASP.NET project using the <embed> tag to put a .swf:
Warning: Validation (XHTML 1.0 Transitional): Element 'embed' is not supported.
What is the "supported" way to do it instead???
...
I want the JQuery validate plugin to only display the validation messages only upon form submit and not when the focus from a input field is lost. How do i achieve this?
Right now I am following this pattern, which leads to validation after lost focus event:
<html>
<head>
<script>
$(document).ready(function(){
$("#commentForm")....
I wanted to know if there is any standard APIs in Java to validate a given URL?
I want to check both if the URL string is right i.e. the given protocol is valid and then to check if a connection can be established.
I tried using HttpURLConnection, providing the URL and connecting to it. The first part of my requirement seems to be fulf...
Using the Enterprise Library 4.1 Validation Application Block, how can I validate that a collection property contains at least one item?
...
I'm using this plugin called validates-existence-of-uri in my model as follows:
class Project < ActiveRecord::Base
validates_uri_existence_of :link, :allow_redirect => false
end
Its working and fine.
And I've a seeds.rb file which seed the data using Faker to generate urls
So, while seeding the data, the above validation tries to ch...
I've done some searching, and I haven't been able to find any kind of open-source lameness filter for rails. Does anything like that exist? I'm trying to curtail lame user generated content, in particular, all caps, improper capitalization, excessive exclamation marks, and excessive bold or italics.
...
Hi,
I need to validate XML file against XML Schema so that the schema info is taken from the XML.
I have XML document which defines its namespace. Like this:
<?xml version="1.0" encoding="UTF-8"?>
<myelement xmlns="mynamespace">
</myelement>
The schema location is not in the document so I'd need to tell the validator where is the s...
The specific of the project is in using Enterpise Library for Server side validation and jQuery for client-side validation. So I have the next simple form for example:
<asp:Content ID="_mainContent" ContentPlaceHolderID="MainContent" runat="server">
<script src="../../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
...
I have some XAML textboxes that need to allow nothing but double and some that need to allow nothing but int.
I could use Binding.ValidationRules with all its code behind, triggers, styles as described here, but isn't there a way for these simple validations to use an attribute something like this, just so nothing but that type can be ...
Hi all,
I have created a Web Service (with Java, Axis). Depending on the content of the request, the response may have a different XSD. So, the WSDL only specifies that the response is of a generic XSD, and the responses comply to XSDs that import and extend the generic XSD.
Unfortunately, the Schema assertion fail because the XSD spec...
I have a situation where I want to compare to fields (example, ensuring the start time is before the end time). I'm using the System.ComponentModel.DataAnnotations attributes for my validation.
My first thought was something like this:
public enum CompareToOperation
{
EqualTo,
LessThan,
GreaterThan
}
public class CompareTo...
Hello,
I am using jQuery's validation plugin to validate a username. Somehow my json request data is invalid and I dont know why. Here is the code:
remote: {
url: "blablabla",
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
...
I'm trying to prevent the jQuery Validation plugin from validating if a certain form option (phone only) is selected using $("#form_id").rules("remove", "required"); feature, but it's not working...
All I get is a javascript error when I select phone only: "TypeError: Result of expression 'F' [undefined] is not an object, and the form w...
If an ASP.NET MVC application using Data Annotations...
<%= Html.ValidationSummary("Things broke...") %>
<% Html.EnableClientValidation(); %>
And we post to the server. Won't we still hit the action, check the ModelState.IsValid and come back to the original view with the validation error. Is it still considered client side validati...
I'm developing application with NHibernate EntityMode.Map so I have entities of IDictionary without cs domain model, database configures only with hbm files. It gives me lots of flexibility.
I want to find out does NH.Validator support this EntityMode.Map too?
If yes how to configure it properly, now I'm getting exceptions related to m...