I've just started to follow the EntLib hands on labs for the validation integration with WPF.
http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8cd377-5522-4f45-a024-44a6ca5111ec&displaylang=en
What I have found is that my textbox's databinding is firing fine when my validators pass.
I have a string property with the follo...
I have a textbox databound to a nullable int through code. If I erase the data from the textbox it gives me a validation error (red border around it).
Here is my binding code:
ZipBinding = new Binding("Zip");
ZipBinding.Source = Address;
zipTextBox.SetBinding(TextBox.TextProperty, ZipBinding);
public Int32? Zip { get { ... } set { ......
I'm reviewing some code in VB.net, and in a validation object they have written the following
If Not IsDate(Entity.SelectedDate) Then
ErrorList.Add(New CValidationError("MainReport", "Please select a weekend date"))
SelectedDate is of type Date. It seems to me it would be impossible to ever hit this condition. Is this tru...
I have often wrapped block level elements with <a> tags in order to make the whole group clickable. For example, say I have a list of events:
<ul>
<li>
<a href="#" style="display: block;">
<div style="float: left; display: inline;">12/12/2010</div>
<div style="float: left; display: inline;">Some event...
Python n00b here
I need to convert an arbitrary string to a string that is a valid variable name in python.
Here's a very basic example:
s1 = 'name/with/slashes'
s2 = 'name '
def clean(s):
s = s.replace('/','')
s = s.strip()
return s
print clean(s1)+'_'#the _ is there so I can see the end of the string
That is a very n...
I have two quite nasty problems with join model. I think I am just going wrong
way, so maybe someone can clear up my approch a bit. First there are some models
with realtions like this:
class Account < ActiveRecord::Base
has_many :tickets, :through => :assigment
has_many :assigments
...
end
accepts_nested_attributes_for :assigmen...
I know email addresses are limited to 254 characters, but is there a single resource that outlines suggested maxlengths for common fields like contact information e.g. phone, city, etc?
It seems every project I work people just shoot from the hip on their proposed limits. I'm hoping to find a canonical reference, targeted to a specific ...
I am working in Symfony 1.0 launching a Thickbox modal window that contains a form, which is being validated on the fly using LiveValidation.
The modal window launches fine, however the LiveValidation plugin is getting an error, saying that "ReferenceError: Can't find variable: LiveValidation" and then referencing various variables I am ...
I have copied an example from MSDN and added the Validation.Error event. Problem is, it never gets fired. Why not?
<UserControl x:Class="MeasurementControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxm...
Hi,
How can I use DataAnnotations to validate that at least one of these fields are filled in?
public string Name { get; set; }
public string State { get; set;}
public string Zip { get; set;}
...
I upgraded to Rails 3 and RSpec 2 and one of my RSpec tests stopped working:
# Job.rb
class Job < ActiveRecord::Base
has_one :location
belongs_to :company
validates_associated :location
end
# Location.rb
class Location < ActiveRecord::Base
belongs_to :job
end
# job_spec.rb
describe Job, "location" do
it "should have a ...
Someone must have written this before :-)
I need a validation attribute for date of birth that checks if the date is within a specific range - i.e. the user hasn't inputted a date that hasn't yet happened or is 150 years in the past.
Thanks for any pointers!
...
[MetadataType(typeof(PersonMetaData))]
public partial class Person {
public class PersonMetaData {
[Required(ErrorMessage="The number is required")]
public object Number {get;set;}
}
}
This error message is shown when the number field is empty and when there's an invalid input it gives "The value 'foo' is not va...
Hi all,
I've used stackoverflow many a time to solve my problems (code related!) but this is the first time I've needed to post a question cause I cannot work out whats wrong.
When I enable client side validation on a view that allows editing of a collection of objects which use DataAnnotations for validation the following exception is...
I am writing a custom validation attribute
It does conditional validation between two fields
When I create my rule, one of the things that I could not solve is how to pass javascript code through ValidationParameters
Usually, I just do
ValidationParameters["Param1"] = "{ required :function(element) { return $("#age").val() < 13;) }"
Ho...
I have a UserControl that contains a TextBox. The TextBox.Text property is data-bound and validated. When a Validation.Error occurs, I would like to edit the Validation.ErrorTemplate. Specifically, I would like adorn it with a Polyline.
The end goal is to have a UserControl that has a red squiggly line under the text when it fails a va...
How to validate form fields on submit button using jquery?
...
To aid navigation we would prefer our users to only create pages that have a title of less than or equal to 30 characters. Is there a relatively easy way that this can be accomplished? I've seen a javascript solution that uses a method called PreSaveAction but it's not really what I'm looking for as it has got to work site wide (whethe...
I have a competition class and a competitionEntry class. A competition can have 5 questions (just string values) and the competitionEntry can have 5 answers (also only string values).
How would I validate that if a question is present that the answer should be present as well?
I think I need a custom validation attribute but how would...
Hi,
I've been looking on the internet for 4 hours and I just can't do it.
My objectives : create a combo where I can sort my items and when I click on one of them, the item appears alone.
In Excel, easy to do, but I can't do it in C#.
I found this answer : Other topic, but I can't understand where the "this.Controls" comes from.
Tha...