dongya9904 2013-10-11 21:29
浏览 26

如何使用Yii删除CJuiDatePicker按钮?

Below is my code. I'd like to know if there's a way to prevent the button to be visible as I only want the textField to show.

<?php
if ($model->fechaCierre1_f!='') 
$model->fechaCierre1_f=date('d-m-Y',strtotime($model->fechaCierre1_f));

$this->widget('zii.widgets.jui.CJuiDatePicker', array(
         'model'=>$model,
         'attribute'=>'fechaCierre1_f',
         'value'=>$model->fechaCierre1_f,
         'language' => 'es',
         'htmlOptions' => array('readonly'=>"", 'class' => 'span1'),
         'options'=> array(
    'dateFormat'=>'yy-mm-dd', 
    'altFormat'=>'dd-mm-yy', 
    'changeMonth'=>'true', 
    'changeYear'=>'true', 
    'yearRange'=>'2012:2014', 
    'showOn'=>'both',
    'buttonText'=>'<i class="icon-calendar"></i>'
),)); ?>
  • 写回答

2条回答 默认 最新

  • dsigh7478 2013-10-12 08:15
    关注

    Remove the following from the code

    $this->widget('zii.widgets.jui.CJuiDatePicker', array(
         'model'=>$model,
         'attribute'=>'fechaCierre1_f',
         'value'=>$model->fechaCierre1_f,
         'language' => 'es',
         'htmlOptions' => array('readonly'=>"", 'class' => 'span1'),
         'options'=> array(
    'dateFormat'=>'yy-mm-dd', 
    'altFormat'=>'dd-mm-yy', 
    'changeMonth'=>'true', 
    'changeYear'=>'true', 
    'yearRange'=>'2012:2014', 
    'showOn'=>'both',
    'buttonText'=>'<i class="icon-calendar"></i>'
    ),));
    

    Then replace it with the following

    echo CHtml::activeTextField($model,fechaCierre1_f,'');
    

    If you still have issues, though you may have already changed the date, possibly also try

    echo CHtml::activeTextField($model,date('d-m-Y',strtotime($model->fechaCierre1_f)),'');
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?