Wiki

Articles in category "how-tos", sorted by viewsX
Displaying 51-60 of 353 result(s).

How to validate CSRF token with session

Created 4 years ago by yangmlsHow-tos2 comments – viewed 50,291 times – ( +23 ) – version 1.1
First of all, You must change component config to enable the default Yii CSRF validation.
tags: CSRF, session

Sort and filter a custom or composite CGridView column - that may even contain data from different tables.

Created 2 years ago by Gerhard LiebenbergHow-tos2 comments – viewed 48,588 times – ( +6 / -1 ) – version 1.1
I have a table (account) which contains "General Ledger" accounts. Each account has its own account_description - such as 'inventory', 'sales', etc.

Using CJuiDatePicker for CGridView filter

Created 4 years ago by softarkHow-tos21 comments – viewed 48,501 times – ( +27 ) – version 1.1
We can use a CJuiDatePicker for a CGridView inline filter.

Moving project code outside of webroot (plus multiple project support)

Created 5 years ago by Steve FriedlHow-tos8 comments – viewed 48,097 times – ( +22 / -1 ) – version 1.1
Yii's by-default directory organization works well enough, but there are several steps one can take that improve the security and serviceability of the system, especially in the context of multiple Yii projects on the same machine (including multiple versions of the same project).
tags: config, security

Write & use a custom Component in Yii2.0

Created 2 years ago by sirin kHow-tos4 comments – viewed 47,207 times – ( +17 ) – version 2.0
This is a simple example in Yii2.0 to understand how you can write a custom component and use it inside your app.(basic template)

Reliable Alternative For Yii::app()->request->isAjaxRequest AND Adding Data To Ajax Form With JS

Created 4 years ago by ibo_sHow-tos2 comments – viewed 46,895 times – ( +15 / -1 ) – version 1.1
In this How-To I'll show you:

Upload image and content using AJAX and Store it in different table

Created 2 years ago by SelvakumarHow-tos1 comment – viewed 46,668 times – ( +3 ) – version 1.1
We all know how to upload the content and images at the same time with refreshing the page. And uploading the images using Ajax we have faced some issues, here i have fixed the issues and both content and photos are uploaded using Ajax. And both content and images are stored in the different tables

How to show ajax delete status in CGridView like flash messages

Created 5 years ago by hasanaviHow-tos12 comments – viewed 43,960 times – ( +25 ) – version 1.1
I've seen many tickets regarding how to show friendly delete confirmation using CGridView's CButtonColumn in ajax request. If you are using relational database, after producing CRUD functionality when you try to delete a record in ajax mode which has child record it can't be deleted and you can see the ajax loader forever. By this way you can't show the users if a record has been successfully deleted or if there are some problem in flash style (setFlash() / getFlash())

How to use GridView with AJAX

Created 2 years ago by Antonio RamirezHow-tos6 comments – viewed 43,879 times – ( +14 ) – version 2.0
With the adoption of PJax on Yii2 things  have change quite a bit with GridView when it comes to work with them in AJAX mode. It will probably be confusing at the beginning, but then you will soon realize how powerful the new approach is.
tags: yii2, pjax, widget

Custom Autocomplete Display and Value Submission

Created 5 years ago by Antonio RamirezHow-tos6 comments – viewed 43,826 times – ( +14 / -1 ) – version 1.1
How many of us has wondered how to create an autocomplete that will display the names of a related models but do require the id of that selected name to be submitted for model creation/update?