Wiki

Articles tagged with "validation rules"X
Displaying 1-9 of 9 result(s).

Optimize Scenarios for yii2

Created 11 months ago by AndroideLPTutorials0 comments – viewed 8,892 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

Created about a year ago by Wade ShulerHow-tos0 comments – viewed 6,178 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

Created 3 years ago by thiagoc7How-tos0 comments – viewed 5,155 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

Created 3 years ago by KabinenkofferHow-tos0 comments – viewed 4,474 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.

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

Created 5 years ago by BoazHow-tos2 comments – viewed 15,794 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.

Understanding Scenarios

Created 5 years ago by Luke JurgsTutorials12 comments – viewed 131,922 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.

Using International Dates

Created 6 years ago by Russell EnglandHow-tos4 comments – viewed 39,072 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/

Create your own Validation Rule

Created 6 years ago by nickcvHow-tos14 comments – viewed 203,278 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.

Reference: Model rules validation

Created 7 years ago by krillzipHow-tos7 comments – viewed 745,498 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.