0

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?

phpdev
  • 511
  • 4
  • 22

1 Answers1

0

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

Community
  • 1
  • 1
szako
  • 1,271
  • 1
  • 9
  • 12