Questions tagged [validationrules]

A validation rule is a criterion used in the process of data validation, after the data has been encoded onto an input medium. This is distinct from formal verification, where the operation of a program is determined to be correct per the specification.

A validation rule is a criterion used in the process of data validation, after the data has been encoded onto an input medium. This is distinct from formal verification, where the operation of a program is determined to be correct per the specification.

An example of a validation check is the procedure used to verify an ISBN:

  1. Size. The number of characters in a data item value is checked; for example, an ISBN must consist of 10 characters only (in the previous version – the standard for 1997 and later has been changed to 13 characters).

  2. Format checks. Data must conform to a specified format. Thus, the first 9 characters must be the digits 0 through 9, and the 10th must be either one of those digits or an X.

  3. Consistency. Codes in the data items which are related in some way can thus be checked for the consistency of their relationship. The first number of the ISBN designates the language of publication. for example, books published in French-speaking countries carry the digit "2". This must match the address of the publisher, as given elsewhere in the record.

  4. Range. Does not apply to ISBN, but typically data must lie within maximum and minimum preset values. For example, customer account numbers may be restricted within the values 10000 to 20000, if this is the arbitrary range of the numbers used for the system.

  5. Check digit. An extra digit calculated on, for example, an account number, can be used as a self-checking device. When the number is input to the computer, the validation program carries out a calculation similar to that used to generate the check digit originally and thus checks its validity. This kind of check will highlight transcription errors where two or more digits have been transposed or put in the wrong order. The 10th character of the 10-character ISBN is the check digit.

Source: Wikipedia

189 questions
2
votes
3 answers

How to set a null value to a property when it throws an error?

Binding is so powerful in WPF. Supposed that we have a Number property (nullable int) and is bound to a textbox. I realized when it throws an error, the property has the last correct value. I mean these are the processes: TEXTBOX: "" PROPERTY:…
Darf Zon
  • 6,268
  • 20
  • 90
  • 149
2
votes
2 answers

Validating a nullable int using a IValueConverter

I'm trying to perform a validation property. We have a nullable property called: public int? Number { get { return _number; } set { if (_number != value) { _number = value; …
Darf Zon
  • 6,268
  • 20
  • 90
  • 149
2
votes
3 answers

How to validate data in WPF and set default value?

I'm trying to perform a validation property. We have a nullable property called: public int? Number { get { return _number; } set { if (_number != value) { _number = value; …
Darf Zon
  • 6,268
  • 20
  • 90
  • 149
2
votes
2 answers

WPF Validation Control

I am new to WPF and trying to implement validation control on submit form. Can anyone help me. My code doen't show up any error message even if I enter invalid data infect it does nothing. Here is my code, public partial class MainWindow :…
user735052
  • 33
  • 2
  • 7
2
votes
1 answer

jquery validate - check which rule is not fulfilled

I have a form with several fields and using jQuery validation plugin. My input has several rules: { required : "#somecheckbox:not(:checked)", regex : "\d{10}", maxlength : 10, remote : [object Object], __dummy__ : true } What I…
Goran Obradovic
  • 8,951
  • 9
  • 50
  • 79
2
votes
1 answer

Use `trans_choice()` in request validation messages with validation rule parameter

I need a request validation rule to return a custom message upon failure, and since the field being validating is an array with a min:x rule i'd like to have a custom message for both singular and plural variations. I'm just wondering how to pass to…
fudo
  • 2,254
  • 4
  • 22
  • 44
2
votes
1 answer

Laravel required_without validation rule in array

Let's say i have an object composed of property_a and property_b, and when submitted have to receive at least one of those two properties. If the object were just one i could use the required_without validation rule as follow return [ …
fudo
  • 2,254
  • 4
  • 22
  • 44
2
votes
1 answer

WPF ValidationTule with binding parameter problem

I need to pass a bind value to my validation rule. This is the XAML code:
2
votes
2 answers

TextBox with Validation. How to update the target property even if the entered text is not valid?

I have a TextBox in my View, bound to a Property MyText in my ViewModel. I also have a ValidationRule for the input. Here is the TextBox in my View:
Yvonnila
  • 635
  • 1
  • 5
  • 22
2
votes
1 answer

Yii2: Different ways of declaring model scenarios?

I have some questions regarding Yii Scenario (this concept is pretty new to me) If I have Post class which extends Model and have the following attributes public $id; public $title; public $body; CONST SCENARIO_SAVE = 'save'; CONST SCENARIO_UPDATE…
postsrc
  • 732
  • 3
  • 9
  • 26
2
votes
2 answers

How to change font size of validation result in WPF C#

I have ValidationRule by using System.Windows.Controls and that rule return some custom message. But the font size is too small and how can I change the font size? Screenshot...Textbox content and error content of validation result Here is example…
2
votes
0 answers

WPF Validation in view

I've implemented for a lot of my TextBox a ValidationRule :
ZwoRmi
  • 1,093
  • 11
  • 30
2
votes
3 answers

Best way to validate an object in java

I'm new to programming. I have a list of objects that I want to validate (not short circuit, but run a list of validation rules by each one). Initially I had a huge if/else statement but it didn't look very pretty. I think something like this would…
2
votes
1 answer

Trouble Parameterizing ValidationRules with Dependency Properties

so I have written the following DP and ValidationRule: public class ComparisonValue : DependencyObject { public Object ComparisonObject { get { return (Object)GetValue(ComparisonObjectProp); } set { …
Mark W
  • 2,791
  • 1
  • 21
  • 44
2
votes
1 answer

ValidationRule with parameters

I'm developing an app with C# and WPF, I've my own slider custom control. and textboxes on the same window. All properties of my slider are DependencyProperty. I use textboxes to change slider's properties. I want to use ValidationRule on…
cKNet
  • 635
  • 1
  • 10
  • 22
1 2
3
12 13