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

Comparing #5 with #6

Revision #6 was created by Kartik V Kartik V on May 24, 2014, 10:51:40 AM.

Updated details

Content

[...]
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`.
[...]