dougou8639 2017-03-23 10:47
浏览 36

如何在yii中接受正确的日期格式1

I have following code in my view file:

 <?= $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $model,
                'attribute' => 'time',
                'language' => 'ru',
                'htmlOptions' => array(
                    'size' => '10',
                    'class' => 'form-control  form_empty centered date',
                ),
                'options' => array(
                    'dateFormat' => 'dd/mm/yy',
                    'showOn' => 'focus',
                    'showOtherMonths' => true,
                    'selectOtherMonths' => true,
                    'changeMonth' => true,
                    'changeYear' => true,
                    'showButtonPanel' => true,
                    'closeText' => Yii::t('ablock', 'Очистить'),
                    'beforeShow' => 'js:
                                function( input ) {
                                    setTimeout(function() {
                                        var clearButton = $(input ).datepicker( "widget" ).find( ".ui-datepicker-close" );
                                        clearButton.unbind("click").bind("click",function(){ $.datepicker._clearDate( input );});
                                    }, 1 )}',
                ),
            ),
                true) ?>

I used this code in order to allow user to enter date. However, it is accepting 0 values. For example, if user enters incomplete date such as 0d/mm/yyyy (which is incorret date), it will accept it as true. I need to not allow, if user enters wrong value. How can I do it?

  • 写回答

1条回答 默认 最新

  • douchun9719 2017-03-26 04:05
    关注

    I haven't found any params for accepting only complete dates. Suggested workarounds:

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂