Revision #24 has been created by TomTheGeek on May 30, 2011, 7:06:15 PM with the memo:
Fixed links
« previous (#22) next (#25) »
Changes
Title
unchanged
By Example: CHtml
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
listData, chtml, link, button
Content
changed
[...]
Smarthead will be pulling these from the forum when he is not finding the answers on his own. Please request examples using the comments below or ask for an example in the forum. Thanks.
Avaiable methods:<br>
- [CHtml::link()
](#hh1)
-
[CHtml::button()
](#hh2)
-
[CHtml::textField()
](#hh3)
-
[CHtml::listData()
](#hh4)
-
[CHtml::dropDownList()
](#hh5)
## CHtml::link() method[...]
```
***
**Example 9: Linking to a controller action via POST with confirmation dialog**
Delete actions created using gii require the delete request be sent via POST to help prevent deleting objects by accident. Below is an example how to create a link that sends the request via POST and also asks for confirmation. Where you are redirected after the delete depends on your delete action.
```php
<?php echo CHtml::link('Delete',"#", array("submit"=>array('delete', 'id'=>$data->ID), 'confirm' => 'Are you sure?')); ?>
```
## CHtml::button() method
~~~
public static string button(string $label='button', array $htmlOptions=array ( ))
~~~
Generates a button.[...]