Wiki

Articles tagged with "model", sorted by ratingX
Displaying 21-28 of 28 result(s).

How to preload dropdowns in CForm

Created 4 years ago by transistorTips0 comments – viewed 6,836 times – ( +1 / -1 )
So you want to use CForm (form builder), but need to preload dropdowns in a form? It's simpler than it seems. You got your CFormModel, CForm and the actual Form, right? Let's say you have the typical State -> City dependent dropdowns, so you would want to load the from with the State and City selected.

Optimize Scenarios for yii2

Created 10 months ago by AndroideLPTutorials0 comments – viewed 8,483 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.

Working with relational removals by yii2

Created 9 months ago by AndroideLPTutorials2 comments – viewed 8,886 times – ( +1 / -1 ) – version 2.0
This tutorial shows you how to safely remove records between relationships.

Generate CTreeview from database table and update a model

Created 3 years ago by Kostas Apazidis (KonApaz)How-tos0 comments – viewed 6,997 times – ( +1 / -1 ) – version 1.1
Suppose we want to set a category to product (or an item in general term), Also suppose categories has sub-categories (multi-level)

Add model validator in Controller

Created 2 years ago by Kostas Apazidis (KonApaz)Tips4 comments – viewed 17,290 times – ( +1 / -2 ) – version 1.1
There are cases that model validators should be depended by controller/action and you couldn't manipulate on the model class or using scenarios in easy way

Save or Update Multiple related model values in one Tabular input form

Created 3 years ago by Kostas Apazidis (KonApaz)Tutorials4 comments – viewed 22,062 times – ( +1 / -8 ) – version 1.1
In this wiki I will show you how to save/update a model with many related model For example: How to set a product to multiple categories only in one post form ?

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

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

A universal model attribute for its synthetic representation

Created about a year ago by Alexandre RodichevskiTips2 comments – viewed 4,248 times – ( -1 ) – version 2.0
It is convenient to use the same identification attribute, say info, in all of the active records of your application. It should be a virtual read-only attribute defined by a getter method, its label being the model name.