Difference between #22 and #24 of
By Example: CHtml

Revision #24 has been created by TomTheGeek on May 30, 2011, 7:06:15 PM with the memo:

Fixed links
« previous (#22) next (#25) »


Title unchanged

By Example: CHtml

Category unchanged


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 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.
78 0
Viewed: 878 283 times
Version: 1.1
Category: Tutorials
Written by: jonah
Last updated by: glicious
Created on: Sep 25, 2009
Last updated: 2 years ago
Update Article


View all history