This source to Apply the AjaxSubmitButton instead of submitButton in yiiYii CHtml ajaxSubmitButton I added ajaxsubmitbutton instead of submitButton. When i click the submit button I will send form data through ajax post and i will do controller work for insert and i render the listdata using CHtml::listData() and i will set the response value to eventlist dropdownlist. So I am updating the event list without page refresh using ajaxsubmitbutton of yiiFor More Details www.bsourcecode.com
Showing posts with label Yii CHtml. Show all posts
Showing posts with label Yii CHtml. Show all posts
Thursday, July 26, 2012
Ajax Submit Button in Yii
by Unknown
Tuesday, July 24, 2012
Yii Hint For Form Radio Button
by Unknown
When you select the radio button, Form will get submit action
Monday, July 23, 2012
insert data into Dropdownlist by ajax request in yii
by Unknown
In view.php ----------------- In controller.php -----------------
Wednesday, May 23, 2012
Yii Search Using Radio Buttons
by Unknown
In _search.php (form) ------------------ In Model.php --------------
Tuesday, May 22, 2012
ajax request with json in yii
by Unknown
Ajax request using Yii ajaxButton
json mixing format like dot,associative array etc In view.php -------------- <?php echo CHtml::ajaxButton('User List',CController::createUrl('user/active'), array( 'type' => 'POST', 'dataType'=>'json', 'data'=>"js:callData()", Call JS Function OR Give datastring 'url'=> 'user/active', 'success'=>"function(response){ alert(response); if(response!=''){ alert(response.url); if(response['message']!=''){ alert(response['message']); } if(response['url']!=''){ window.location=response['url']; } } }", ),array('id'=>'activebtn') ); ?> In Controller .php ------------------ public function actionactive() { $returnmessage['message']=$successmessage; $returnmessage['url']="url"; echo json_encode($returnmessage); }
Checkbox value in ajax request of yii
by Unknown
This is one of the way to send data dynamicallay in ajaxbutton request of yii. When you click on ajaxbutton We will get the selected checkbox value and send this via ajax
Monday, May 21, 2012
CHtml Ajax Button in yii
by Unknown
Example 1: In view.php page Write Follwing source code In controller.php write following source code Example 2:
Wednesday, May 16, 2012
Thursday, May 10, 2012
Date Picker In Yii
by Unknown
- Yii CJuiDatePicker: Default
- Yii CJuiDatePicker: Inline
- Yii CJuiDatePicker: Show/Select Other Month Dates
- Yii CJuiDatePicker: Display Button Bar(showButtonPanel)
- Yii CJuiDatePicker: Display Month & Year Menus
- Yii CJuiDatePicker: Display Multiple Months
- Yii CJuiDatePicker: Date Format
- Yii CJuiDatePicker: Date Range
Yii CJuiDatePicker: Default
<h1>Yii CJuiDatePicker: Default</h1> <script> $(function() { $( "#anim" ).change(function() { $( "#datepicker" ).datepicker( "option", "showAnim", $( this ).val() ); }); }); </script> <p>Animations:<br> <select id="anim"> <option value="show">Show (default) => show</option> <option value="slideDown">Slide down => slideDown</option> <option value="fadeIn">Fade in => fadeIn</option> <option value="blind">Blind (UI Effect) => blind</option> <option value="bounce">Bounce (UI Effect) => bounce</option> <option value="clip">Clip (UI Effect) => clip</option> <option value="drop">Drop (UI Effect) => drop</option> <option value="fold">Fold (UI Effect) => fold</option> <option value="slide">Slide (UI Effect) => slide</option> <option value="">None</option> </select> </p> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker', // additional javascript options for the date picker plugin 'options'=>array( 'showAnim'=>'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop' ), 'htmlOptions'=>array( 'style'=>'height:20px;background-color:green;color:white;', ), )); ?>
Yii CJuiDatePicker: Inline
<h1>Yii CJuiDatePicker: Inline</h1> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker-Inline', 'flat'=>true,//remove to hide the datepicker 'options'=>array( 'showAnim'=>'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop' ), 'htmlOptions'=>array( 'style'=>'' ), )); ?>
Yii CJuiDatePicker: Show/Select Other Month Dates
<h1>Yii CJuiDatePicker: Show/Select Other Month Dates</h1> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker-other-month', 'flat'=>true,//remove to hide the datepicker 'options'=>array( 'showAnim'=>'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop' 'showOtherMonths'=>true,// Show Other month in jquery 'selectOtherMonths'=>true,// Select Other month in jquery ), 'htmlOptions'=>array( 'style'=>'' ), )); ?>
Yii CJuiDatePicker: Display Button Bar(showButtonPanel)
<h1>Yii CJuiDatePicker: Display Button Bar(showButtonPanel)</h1> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker-showButtonPanel', 'value'=>date('d-m-Y'), 'options'=>array( 'showAnim'=>'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop' 'showButtonPanel'=>true, ), 'htmlOptions'=>array( 'style'=>'' ), )); ?>
Yii-CJuiDatePicker: Display Month & Year Menus
<h1>Yii CJuiDatePicker: Display Month & Year Menus</h1> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker-month-year-menu', 'flat'=>true,//remove to hide the datepicker 'options'=>array( 'dateFormat' => 'yy-mm-dd', 'showAnim'=>'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop' 'changeMonth'=>true, 'changeYear'=>true, 'yearRange'=>'2000:2099', 'minDate' => '2000-01-01', // minimum date 'maxDate' => '2099-12-31', // maximum date ), 'htmlOptions'=>array( 'style'=>'' ), )); ?>
Yii CJuiDatePicker: Display Multiple Months
<h1>Yii CJuiDatePicker: Display Multiple Months</h1> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker-multiple-month', 'flat'=>true,//remove to hide the datepicker 'options'=>array( 'numberOfMonths'=>2, 'showButtonPanel'=>true, ), 'htmlOptions'=>array( 'style'=>'' ), )); ?>
Yii CJuiDatePicker: Date Format
<h1>Yii CJuiDatePicker: Date Format</h1> <script> $(function() { $( "#date-format" ).change(function() { $( "#datepicker-date-format" ).datepicker( "option", "dateFormat", $( this ).val() ); }); }); </script> <p>Format options:<br /> <select id="date-format"> <option value="mm/dd/yy">Default - mm/dd/yy</option> <option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option> <option value="d M, y">Short - d M, y</option> <option value="d MM, y">Medium - d MM, y</option> <option value="DD, d MM, yy">Full - DD, d MM, yy</option> <option value="'day' d 'of' MM 'in the year' yy">With text - 'day' d 'of' MM 'in the year' yy</option> </select> </p> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker-date-format', 'value'=>date('d/m/Y'), 'options'=>array( 'showButtonPanel'=>true, 'dateFormat'=>'mm/dd/yy',//Date format 'mm/dd/yy','yy-mm-dd','d M, y','d MM, y','DD, d MM, yy' ), 'htmlOptions'=>array( 'style'=>'' ), )); ?>
Yii CJuiDatePicker: Date Range
<h1>Yii CJuiDatePicker: Date Range</h1> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'name'=>'datepicker-min-max', 'value'=>date('d-m-Y'), 'options'=>array( 'showButtonPanel'=>true, 'minDate'=>-5, 'maxDate'=>"+1M +5D", ), 'htmlOptions'=>array( 'style'=>'' ), )); ?>
Monday, May 7, 2012
CHtml-link
by Unknown
CHtml::link() method
public static string link(string $text, mixed $url='#', array $htmlOptions=array ( ))
Generates a hyperlink tag.
Just remove the 'controller' part from the string If you are linking to an action from another controller, use the syntax of the former examples.
Read More...
- Linking to a controller action
- Linking to a controller action with query string parameters
- Linking to a controller action with multiple query string parameters
- Link opening a new page
- Linking to a controller action inside the actual controller
- Linking to a controller action from the site root
- Linking to a controller action from another module
- Linking to a controller action from the same module
- Linking to a controller action via POST with confirmation dialog
- Linking to a controller action via POST with POST parameters
- Link With Image
Linking to a controller action
HTML Output:<a href="index.php?r=controller/action">Link Text</a>
Linking to a controller action with query string parameters
HTML Output:<a href="index.php?r=controller/action¶m1=value1">Link Text</a>
Linking to a controller action with multiple query string parameters
HTML Output:<a href="index.php?r=controller/action¶m1=value1¶m2=value2¶m3=value3"> Link Text </a>
Link opening a new page
HTML Output:<a target="_blank" href="index.php?r=controller/action¶m1=value1">Link Text</a>
Linking to a controller action inside the actual controller
(Suppose you are in the PostController/view and wants to link to PostController/create)Just remove the 'controller' part from the string If you are linking to an action from another controller, use the syntax of the former examples.
Linking to a controller action from the site root
(Suppose you are inside a module and wants to make the link from a controller of the root application) In this case, add an slash "/" at the start of the string url This makes more sense if you are working with modules.Linking to a controller action from another module
Replace below the module-id with desired module id .Linking to a controller action from the same module
This is useful when you want to make absolute paths avoiding to use static module names.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. Note that the id link parameter below is a GET type parameter (submit URL will be something like http://example.com/post/delete/id/100). If you are using CSRF protection in your application do not forget to add csrf parameter to the htmlOptions array.Linking to a controller action via POST with POST parameters
If you need to make POST request with arbitary link with additional POST parameters you should use following code (submit URL will be something like http://example.com/blog/deletePost/param/100).Link With Image
CHtml::link( "<img src='".Yii::app()->baseUrl."/images/userimage.png"."' />", Yii::app()->createAbsoluteUrl("user/image",array("id"=>$this->user_id)) );
Yii CHtml
by Unknown
Avaiable methods:
- CHtml::link()
- CHtml::button()
- CHtml::textField()
- CHtml::listData()
- CHtml::dropDownList()
- CHtml::ajaxButton()