Yii is a high-performance, component-based, open source PHP framework best for developing Web 2.0 applications. It is one of only few PHP frameworks that supports EDP (Event-Driven Programming) and this tag contains questions that are specific to events in Yii.
Questions tagged [yii-events]
89 questions
10
votes
2 answers
How add CJuiDatePicker in JQRelcopy on Yii Framework
I have a problem with CJuiDatePicker in the module JQRelcopy on Yii framework.
I use this module as I have a form with a datepicker field to be copied as many times as the user wishes.
The module works fine if I put a normal field (without…

Florent
- 761
- 1
- 10
- 24
8
votes
2 answers
How to use events in Yii
I want to run some code in the onBeginRequest event.
Where do I do that? I assume I am not suppose to add this in the core library code.
I am a totally noob in Yii

Itay Moav -Malimovka
- 52,579
- 61
- 190
- 278
7
votes
1 answer
Non-Editable Text-Field
I am new in YII, i am wondering if the text-field in YII can made non-editable. If so can anyone answer.
I do the following way..
labelEx($model,'first_name'); ?>

tnchalise
- 1,573
- 2
- 18
- 38
5
votes
1 answer
Difference between afterSave and a Event in yii2?
I wanted to send an email to admin when a new user registers. I think i can do it using two ways. one way is to use events and other is by using afterSave.
By using Events
Controller code
public function actionCreate()
{
$model = new…

Bloodhound
- 2,906
- 11
- 37
- 71
5
votes
3 answers
Disable sorting in header column of Yii CGridView
Yii provides sorting functionality for listing. How can I disable sorting so that my records will not get sorted when clicked on column header?

Rukmi Patel
- 2,619
- 9
- 29
- 41
3
votes
1 answer
When should I call parent::beforeDelete() in my Yii model
Up until now I was always calling / checking result of parent::beforeDelete() before I my own code:
public function beforeDelete()
{
if(parent::beforeValidate())
{
$this->short = strtolower(preg_replace("/[^a-zA-Z0-9_-]+/", "",…

trejder
- 17,148
- 27
- 124
- 216
3
votes
2 answers
Yii generates a jQuery version 1.71. how do i force yii to use a specific jquery version
I had an issue when trying to incorporate multiple date picker which can be found here : http://multidatespickr.sourceforge.net/
The issue I had is explained in the following stackoverflow. : …

dev1234
- 5,376
- 15
- 56
- 115
3
votes
2 answers
How to pass parameters to event handlers in yii?
I am impressed by the flexibility of Yii events. I am new to Yii and I want to know how to pass parameters to Yii event handlers?
//i have onLogin event defined in the login model
public function onLogin($event)
{
$this->raiseEvent("onLogin",…

Ejaz Karim
- 3,676
- 6
- 36
- 49
3
votes
2 answers
Disable validation in Yii
I am trying to implement a "Save as Draft" functioning in my project using Yii. I have a form with 2 buttons :- Submit and Save . On clicking the Submit button , after validating all the fields including required fields the form data is saved into…

anu
- 458
- 2
- 13
- 36
3
votes
3 answers
Yii: attaching events to models
I have a User model which is bundled in a module installed on my Yii application. This module is third party and I do not want to alter its code.
I also have a Cv Model that has a BELONGS_TO relation with the User model.
My question is: How can I…

antoniom
- 3,143
- 1
- 37
- 53
3
votes
3 answers
YII compress your application output using gzip
what is the benefit of below code that is two events.
what its actually doing ??
require_once($yii);
$app = Yii::createWebApplication($config);
Yii::app()->onBeginRequest = function($event)
{
return…

Edward Maya
- 429
- 2
- 10
- 25
2
votes
2 answers
Dynamic User Profile management in yii?
I have two tables in database profile_fields and profile_fields_values.
Table profile_fields has columns
id
fieldname
fieldtitle
fieldtype
orderby
required
published
Table profile_field_values has columns
id
field_id
user_id
field_value
Here I…

Gaurav Parashar
- 126
- 11
2
votes
2 answers
Custom validation rule is not working for CFormModel
My front end is Php Yii. I am trying to create a custom validation rule which checks to see if the username already exists in the database.
I don't have direct access to the database. I have to use the RestClient to communicate with the Database. My…

Mahesh Eu
- 515
- 1
- 6
- 21
2
votes
1 answer
How to make Yii beforeSave breaks the save
I would like in some cases the beforeSave in an Yii Behavior to breaks the save and return an error. What I have tried, and not worked is:
public function beforeSave($event) {
parent::beforeSave($event);
$tested_value = null;
…

Constantin.FF
- 687
- 1
- 10
- 23
2
votes
4 answers
Using $this when not in object context in Yii
Iam getting an error like Fatal error: Using $this when not in object context in ..\controllers\ServiceRequestController.php on line 661 when calling a view file using controller action from EasyTabs extension. Iam calling the controller action like…

anu
- 458
- 2
- 13
- 36