Revision #6 has been created by Kartik V on May 24, 2014, 10:51:40 AM with the memo:
Updated details
« previous (#5)
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`.[...]