Let's take the example of the above article to display an email button next to a delete button:
Let's take the example of the above article to display an email button next to a delete button:
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 ?
Suppose you want to have a list in Category with its related products and you want to updates the list (removing or insert product items) This wiki show us how to do that
// In Yii 1.x $form = $this->beginWidget('CActiveForm', [
'id' => 'order-search-form',
'method' => 'get',
]);
echo $form->textInput($searchModel, 'id');
echo CHtml::submitButton('Find', ['class' => 'btn btn-primary']);
$this->endWidget();
`
In this article you'll learn how to send additional form data when uploading files using XUpload widget
In this mini howto I would like to show how to add a required captcha field in the login form, after a defined number of unsuccessfull attempts. To do this, I will use the blog demo that you have in default Yii download package (path/to/yii/demos/blog).
For each column of the CGridView, we can specify name
, value
, htmlOptions
, cssClassExpression
etc. In the declarations of the attributes value
and cssClassExpression
we can use the "special" variable $data
, for example like this: 'value'=>'$data->author->username',
.
Now we might want to use $data
in the declaration of the `...
Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).
I'm developing a website that has an option to look up a car's registration number via SOAP and return additional details such as make, model, colour etc.
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $dataprovider,
'id'=>'recipient_table',
'selectionChanged'=>'updateEditForm',
'columns' => array(
'rec_id',
'org.nachname',
'org.vorname',
'org_id',
array(
'class'=>'CButtonColumn',
'template'=>'{...
In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.
Here is overloaded version of CActiveForm.labelEx that adds colon (:) at the end of text of label with respecting CHtml::$afterRequiredLabel and CHtml::$beforeRequiredLabel