yii-widgets

How to put default value in CJuidatepicker in Yii?

扶醉桌前 提交于 2020-01-16 01:16:09
问题 I have the code below to display a calendar input in Yii form. <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array( 'name' => 'publish_date', 'attribute' => 'publish_date', 'model'=>$model, 'options'=> array( 'dateFormat' =>'yy-mm-dd', 'defaultDate' => '2014-3-4', 'altFormat' =>'yy-mm-dd', 'changeMonth' => true, 'changeYear' => true, 'appendText' => 'yyyy-mm-dd', ), )); ?> The default value work on the calendar but I want to show it by default in the calendar input too when the form

Yii widget reload via ajax

我是研究僧i 提交于 2020-01-06 02:16:27
问题 I need to reload a content of my Yii widget via AJAX every XX seconds. This is my widget code: class UserOnlineWidget extends CWidget { public function init(){ } public function run(){ $userOnline=User::getOnlineUser(); $this->render("userOnLineWidget", array('userOnline'=>$userOnline)); } } And this is the view userOnLineWidget.php: <div class="userOnline"> <h5>User Online</h5> <ul> <?php foreach($userOnline as $user) { ?> <li> <ul> <li><?php echo CHtml::link($user['username'], array('/site

Hide label for input field

℡╲_俬逩灬. 提交于 2019-12-20 16:21:47
问题 I am trying to hide the label for a specific field in _form.php without success. I have tried couple of variation like, but none is working: <?= $form->field($model, 'sample_text')->textArea('label'=>false) ?> and alternate code: <?= $form->field($model, 'sample_text')->textArea('label'=>'') ?> What is the right approach to hide a label? 回答1: Ok, I found the solution. <?= $form->field($model, 'sample_text')->textArea()->label(false) ?> 回答2: Or you can modify template value for particular

Split ActiveForm fields into different tabs with Tabs widget

你离开我真会死。 提交于 2019-12-10 10:06:02
问题 I'm creating a form view and I want to organize the form fields with tabs structure, using the official Tabs widget. Is it possible init the Tabs widget with the id (or class) of the div elements that contains the active form fields? 回答1: One example of how you can manage it is doing like this: First, divide your contact-form into one view-file for each tab. Place the ActiveForm::begin() and ActiveForm::end() around the Tabs::widget() Render the contact-form pages into content, with

Hide label for input field

▼魔方 西西 提交于 2019-12-03 04:19:22
I am trying to hide the label for a specific field in _form.php without success. I have tried couple of variation like, but none is working: <?= $form->field($model, 'sample_text')->textArea('label'=>false) ?> and alternate code: <?= $form->field($model, 'sample_text')->textArea('label'=>'') ?> What is the right approach to hide a label? Ok, I found the solution. <?= $form->field($model, 'sample_text')->textArea()->label(false) ?> Or you can modify template value for particular field and remove {label} part from it. I.e.: <p><?= $form->field($page, 'image', [ 'template' => '<div class=\"\">