Wiki

Sorted by ratingX
Displaying 51-60 of 726 result(s).

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

Created 8 months ago by Kartik VTips0 comments – viewed 3,515 times – ( +31 ) – version 2.0
The yii2-field-range extension enables you to easily setup ActiveField range fields with Bootstrap styling. You basically can setup two attributes joined together like a single field with combined validation error block.

How to automate timestamps in ActiveRecord models

Created 5 years ago by dalipTutorials8 comments – viewed 111,546 times – ( +30 ) – version 1.1
There are many ways to automate the setting of timestamps in yii ActiveRecord models. Three are presented here:

Searching and Sorting by Count of Related Items in CGridView

Created 2 years ago by softarkHow-tos14 comments – viewed 32,305 times – ( +30 ) – version 1.1
Let's say we have two models and relation between them:

Creating Yii applications with composer

Created 2 years ago by schmunkTutorials2 comments – viewed 46,560 times – ( +30 ) – version 1.1
Creating Yii applications with composer

Save and Display Date/Time Fields in different formats in Yii2

Created 8 months ago by Kartik VHow-tos10 comments – viewed 12,255 times – ( +30 ) – version 2.0
You would find having such a need in most Yii Projects. Your database needs a specific format to store date fields, while you may want to display it in different formats to the users on forms and other views.

Editing, Deleting, and Viewing model data with the yii2-detail-view extension

Created 8 months ago by Kartik VTutorials0 comments – viewed 7,481 times – ( +30 ) – version 2.0
The yii2-detail-view extension offers you an easy way to EDIT and VIEW your model data, toggle these modes, and adds other features. You can read the extension documentation and/or view a demo of this extension, to understand usage.

How to add more information to Yii::app()->user

Created 5 years ago by qiangTutorials2 comments – viewed 126,987 times – ( +29 ) – version 1.1
By default, the expression Yii::app()->user returns a CWebUser application component which represents the information that are closely related with the current user. Some information can be persistent throughout the current user session. For example, CWebUser already comes with a name property that stores the username of the current user.

Understanding Scenarios

Created 3 years ago by Luke JurgsTutorials11 comments – viewed 85,653 times – ( +29 ) – 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.

Code style

Created 4 years ago by zaccariaTips2 comments – viewed 14,264 times – ( +29 ) – version 1.1
Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.
tags: mvc

Enforcing "You must agree" requirements in forms

Created 4 years ago by Steve FriedlHow-tos3 comments – viewed 17,259 times – ( +29 ) – version 1.1
Checkboxes have two possible values, true and false, but some applications require that the user select one particular value before proceeding. Examples might be:
tags: validation