Yii CHtml Tutorials

CHtml Button

CHtml is a static class and it is used to generate a button.public static string button(string $label='button', array $htmlOptions=array ( )) CHtml class used in CFormButtonElement to represents a form button element. CFormButtonElement have the 8 types of button types. The types are htmlButton, button, submitButton, imageButton, resetButton and link button.htmlButton: Type-buttonhtmlButton: Type-submithtmlButton: Type-resetbutton: Type-buttonbutton: Type-submitbutton: Type-resetsubmitButtonimageButtonresetButtonlinkButtonhtmlButton: Type-button <?php echo CHtml::htmlButton('HTML BUTTON',array( "id"=>'chtmlbutton', "class"=>'chtmlbuttonclass') ); ?> Output <button type="button" name="yt0" […]... Read More »

Yii Ajax

Ajax Submit ButtonAjax ButtonAjax LinkAjax Support Ajax Submit ButtonAjax submit button can submit the current form in POST method. public static string ajaxSubmitButton( string $label, mixed $url, array $ajaxOptions=array ( ), array $htmlOptions=array ( ) ) $lable – the button label$url – the URL for the AJAX request. If empty, it is assumed to be the current URL.$ajaxOptions – data, success, update, replace,etc..;$htmlOptions – add HTML attributes here ex. name, id […]... Read More »