Difference between #5 and #6 of
Model validation for field ranges using yii2-field-range extension

Changes

Title unchanged

Model validation for field ranges using yii2-field-range extension

Category unchanged

Tips

Yii version unchanged

Tags unchanged

yii2, yii2-field-range, range, from, to, model, validation, rules, kartik, kartik-v, date, time, amount

Content changed

[...]
Here are a few tips on configuring model validation rules for your two attributes using this extension:

Scenario 1: Field 1 should not equal Field 2
============================================
As mentioned in the
[first example in the extension demo site](http://demos.krajee.com/field-range#usage), let's say you have two attributes configured with a dropDownList named `start_place` and `end_place`. Your start_place and end_place should not be same when selected either way. Setup the following rules in your model:
[...]
Scenario 2: Attribute 2 cannot be less than Attribute 1
=======================================================
As mentioned in the
[second example in the extension demo site](http://demos.krajee.com/field-range#usage), let's say you have two attributes configured: `from_amount` and `to_amount`. For this scenario, let's say following rules are needed:

- Both amounts are required
- Both amounts must be numeric/decimals.
- Both amounts cannot exceed zero.
- The `to_amount` cannot be less than `from_amount`.
[...]
0 0
37 followers
Viewed: 28 608 times
Version: 2.0
Category: Tips
Written by: Kartik V
Last updated by: Kartik V
Created on: May 24, 2014
Last updated: 10 years ago
Update Article

Revisions

View all history