Wiki

Articles tagged with "validation rules", sorted by date (updated)X
Displaying 1-9 of 9 result(s).

How to "masquerade" a non-required form element as 'required' one (in the view only)

Updated about a year ago by mrunHow-tos2 comments – viewed 16,117 times – ( +7 / -2 ) – version 1.1
In a nutshell, the task at hand is to mark (or render) a model attribute in the typical "_form.php" view file with the 'required' red asterisk while this attribute is not marked as required in the model's rule() method. If you're interested only in the solution, jump ahead to the 'solution' section below.

Optimize Scenarios for yii2

Updated about a year ago by AndroideLPTutorials0 comments – viewed 9,674 times – ( +1 / -1 ) – version 2.0
Working with scenarios, with models that can receive many modifications in their rules or structures as development evolves, can create disruptions in the rescue process.

How To: Custom Client Validation On Checkbox Toggle and Optional Input Field

Updated about a year ago by Wade ShulerHow-tos0 comments – viewed 6,585 times – ( -1 ) – version 2.0
I just chased my tail around for a bit today. I got lost with setting the status of all inputs, and banging my head on why the "validate" function just wasn't working.

using 'whenClient' for complex client side validation

Updated 3 years ago by thiagoc7How-tos0 comments – viewed 5,664 times – ( +1 / -1 ) – version 2.0
You have a 'Category' model with Id, Name and Visibility (boolean, where 0 = Public, and 1 = Private).

Special Validation Rule - Fill out a Field or another group of Fields

Updated 3 years ago by KabinenkofferHow-tos0 comments – viewed 4,630 times – ( +1 / -3 ) – version 1.1
If you have a form, you sometimes need special validation Rules not included in Yii. Here i share a special rule with you, i just wrote. Maybe you have the case, when a user needs to Fill ou Field A oder the Fields B, C and D.

Reference: Model rules validation

Updated 4 years ago by RodrigoHow-tos7 comments – viewed 751,876 times – ( +128 / -1 ) – version 1.1
This is a reference to be used for Model rule validation and is compiled from the Yii documentation and code. The purpose is to have all the information gathered in one place instead of scattered. This reference is not an intro. See The Definitive Guide to Yii, Declaring Validation Rules for a tutorial.

Understanding Scenarios

Updated 4 years ago by Luke JurgsTutorials12 comments – viewed 133,965 times – ( +31 / -1 ) – version 1.1
Scenarios are an extremely useful tool for separating validation tasks on any class you use derived from CModel. In this tutorial we will use CActiveRecord.

Create your own Validation Rule

Updated 5 years ago by GismoHow-tos14 comments – viewed 205,771 times – ( +76 / -4 ) – version 1.1
Some times the core validation rules provided by Yii won't satisfy all your needs, so you'll need to create your very own validation rule.

Using International Dates

Updated 5 years ago by nkdHow-tos4 comments – viewed 39,384 times – ( +18 / -1 ) – version 1.1
I needed British (dd/mm/yyyy) formatted dates throughout my application but found it very difficult to find examples of how to do this - until I found this excellent forum post http://www.yiiframework.com/forum/index.php?/topic/3649-dealing-with-i18n-date-formats/