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
1 answer

Simple Validation Rule inside the Model

I refered here Laravel 4.2 Validation Rules - Current Password Must Match DB Value Here is my Rule for Password Confirmation : public static $ruleschangepwd = array( 'OldPassword' => array( 'required'), // need to have my rule here …
AngularAngularAngular
  • 3,589
  • 5
  • 25
  • 41
2
votes
1 answer

How do i force wpf ValidationRules binding?

I have a textbox for example that is bound via the mvvm pattern like this:
eyalhakim
  • 208
  • 1
  • 11
2
votes
0 answers

Force focus te stay on an ExceptionValidationRule

On a WPF application, i use binding on severals TextBox with ExceptionValidationRule. I would like to be able to stay on the contrôls which have an ApplicationException whitout leaving it until it have a correct data input. Is there possible ? Here…
Walter Fabio Simoni
  • 5,671
  • 15
  • 55
  • 80
1
vote
1 answer

Access 2007 If Statement in a Validation Rule

I have an Inventory Database and I need to add a validation rule to the quantity field when the user inputs the amount of an item into the system. I want it to stop the user if he is inputting a # greater then that which is currently in stock…
user127181
  • 735
  • 3
  • 11
  • 32
1
vote
4 answers

Using Validation in WPF With Dependency Property and Style Triggers

I am trying to use Validation in WPF. I created a NotNullOrEmptyValidationRule as shown below: public class NotNullOrEmptyValidationRule : ValidationRule { public override ValidationResult Validate(object value, CultureInfo…
azamsharp
  • 19,710
  • 36
  • 144
  • 222
1
vote
1 answer

WPF TextBox ValidationRule binding

I need to add ValidationRule to the TextBox programmatically in WPF. I'm trying something like: Binding binding = BindingOperations.GetBinding(myTextBox,…
mxpv
  • 946
  • 2
  • 10
  • 31
1
vote
1 answer

Can you use ValidationRules on ListBox.SelectedItems?

I want to use ValidationRules to verify that a few ListBox controls have at least one item selected. I tried doing it this way:
Anthony Brien
  • 6,106
  • 7
  • 43
  • 56
1
vote
0 answers

Laravel 8.x Password Defaults Validation

I am trying to use the Laravel's Rule\Password::defaults($callback) to add validation rules for registering users. As per documentation of the defaults function: Set the default callback to be used for determining a password's default rules. If no…
1
vote
2 answers

wpf validation rules problem with textbox

I created a class IntegersValidationRule which inherits from ValidationRule. Now I don't know what code should I write in XAML. That's what I have:
Sergey
  • 11,548
  • 24
  • 76
  • 113
1
vote
1 answer

How do I validate email in array laravel

I am sending data request in this format to my laravel backend application array:2 [ 0 => array:2 [ "email" => "sam@gmail.com" "role_id" => 2 ] 1 => array:2 [ "email" => "joy@gmail.com" "role_id" => 3 ] ] How do I validate…
etranz
  • 891
  • 2
  • 10
  • 29
1
vote
1 answer

Rules should return a string or boolean, received 'object' instead when using more then one rule

I'm trying to validate a vuetify v-text-field. I have two rules, one for required field and the other for validating thar user only enters positive numbers. But it doesn't work, I get this error: [Vuetify] Rules should return a string or boolean,…
1
vote
1 answer

Extending a TextBox prevents ValidationRule error tooltip from appearing WPF

I'm rather new to WPF and XAML, and I'm attempting to create a custom class that extends TextBox, so that I can add some properties for easier validation setup. The validation works fine. The problem is, when I swap out the TextBox in the XAML, the…
1
vote
1 answer

Nested alternative validation required_without in laravel 5.8

here is my request { "formulations": [ { "formulation_id": null, "formulation_custom_name": "test", "meal_time_id": null, "remark": "demo1" }, { …
1
vote
2 answers

Laravel - How to validate Unique Rule Request as case sensitive

I have this Rules in my Laravel-5.8 Rules: create public function rules() { return [ 'location_name' => [ 'required', 'string', 'min:3', 'max:80', Rule::unique('hr_work_locations',…
mikefolu
  • 1,203
  • 6
  • 24
  • 57
1
vote
1 answer

WPF TextBox IValueConverter ConvertBack not triggered when ValidationRules fail

I have a TextBox which is linked to a double? in my backend viewModel. I need the ConvertBack to trigger when I empty the TextBox, but the validationRule "ValidateNotNullOrWhiteSpace" fail so there is no call to ConvertBack. My problem is that when…