duangan6731 2012-02-24 05:36
浏览 70
已采纳

以Yii输入表格显示当前日期

I have an input form for date input.I have used Datetime Picker for input date.I have used this code for input date field.

<div class="row">
  <?php echo $form->labelEx($model,'Form_issue_date'); ?>
  <?php 
  $this->widget('zii.widgets.jui.CJuiDatePicker',
  array(
        'attribute'=>'Form_issue_date',
        'model'=>$model,
        'options' => array(
                          'mode'=>'focus',
                          'dateFormat'=>'d MM, yy',
                          'showAnim' => 'slideDown',
                          ),
  'htmlOptions'=>array('size'=>30,'class'=>'date'),
      )
  );
  ?>
  <?php echo $form->error($model,'Form_issue_date'); ?>
</div>

Now I want that the same input field will be there but current date should be seen on the input form area by default.If any user wants to change the date then he will click on that, after that the date picker should come and in that the user will change the date.

  • 写回答

2条回答 默认 最新

  • dongzha2525 2012-02-24 06:13
    关注

    Simply add the value field to your htmlOptions of the CJuiDatePicker, so your code is:

    $this->widget('zii.widgets.jui.CJuiDatePicker',
     array(
        'attribute'=>'Form_issue_date',
        'model'=>$model,
        'options' => array(
                          'mode'=>'focus',
                          'dateFormat'=>'d MM, yy',
                          'showAnim' => 'slideDown',
                          ),
        'htmlOptions'=>array('size'=>30,'class'=>'date', 'value'=>date("d F, Y")),
     )
    );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写