Wiki

Articles in category "how-tos", sorted by commentsX
Displaying 101-110 of 182 result(s).

Drop down list with enum values for column of type ENUM >+> incorporate into giix

Created about a year ago by c@cbaHow-tos2 comments – viewed 12,534 times – ( +11 )
Let's say our table 'mug' has a column named 'color' of the type ENUM('red','green','blue'). We want to replace the textfield for the attribute color in the create and update forms of a 'mug' with a drop down list, which has the enum values as options. The main code was contributed by zaccaria in the forum (see this post).

How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView

Created about a year ago by c@cbaHow-tos2 comments – viewed 5,354 times – ( +9 )
As you know, the CDetailView widget displays details of a single model. If no formatting is specified, boolean values that are stored in the database as 0 and 1, are represented in the detail view as 0 and 1. If formatted as boolean, they are represented as 'No' and 'Yes'. We want to add i18n support, so that Yes and No appear in the current language.

AssetManager: clearing browser's cache on site update

Created about a year ago by dhampikHow-tos2 comments – viewed 12,096 times – ( +14 )
If you like the things to be short and clear, then you can skip right to a short summary of instructions at the end of this article.

How to hide `index` action from URL

Created 11 months ago by rootbearHow-tos2 comments – viewed 6,264 times – ( +3 / -2 )
Here is my experiment inspired by my own question and others from the forum.
tags: index

Using recaptchlib in your projects

Created 2 years ago by Antonio RamirezHow-tos2 comments – viewed 5,318 times – ( +5 )
It is good when someone writes extensions for us but trust, sometimes we forget about other approaches that, if we know the library, we shouldn't forget.

Setting and getting systemwide static parameters

Created 2 years ago by Steve FriedlHow-tos2 comments – viewed 28,666 times – ( +10 )
Occasionally one wishes to set systemwide parameters for an application, such as a contact address for email, an application name, or setting an option that guides major behavior. Yii provides for setting of static parameters in the configuration file, and this article talks about how to do it conveniently.
tags: config

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

Created 8 months ago by BoazHow-tos2 comments – viewed 3,210 times – ( +5 / -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.

Enforcing "You must agree" requirements in forms

Created 2 years ago by Steve FriedlHow-tos2 comments – viewed 9,115 times – ( +26 )
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

Javascript and AJAX with Yii

Created 7 months ago by François GannazHow-tos2 comments – viewed 31,325 times – ( +27 )
This page intends to provide an exhaustive guide of how to use Javascript (JS) in Yii. It does not explain how to learn coding in JS, but how to deal with it "the Yii way".
tags: javascript, AJAX

Serial Numbers (item counts) in GridView

Created 7 months ago by PeRoChAkHow-tos2 comments – viewed 3,348 times – ( +1 )
Sometime we need to display numbers of items per page with their counting as a serial number.