drmovi
(Drmovi)
1
hi every body
take a look at this code in rules for date validation
array('start_publish','date','format'=>'DD/MM/yyyy','timestampAttribute'=>'start_publish','allowEmpty'=>false)
in my view file i use CJuiDatePicker like the following
<div class="row">
<?php echo $form->labelEx($model,'start_publish'); ?>
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'model'=>$model, 'attribute'=>'start_publish',
'options'=>array(
'dateFormat'=>'dd/mm/yy',
),
)) ?>
<?php echo $form->error($model,'start_publish'); ?>
</div>
but when i submit it give invalid date format
so what where is the error ?
alirz23
(Alirz23)
2
Hi this is your code notice i changed the format to dd/MM/yyyy
but i would encourage you to use the fowllowing
traprajith
(Traprajith)
3
check ur database date format and rules in the model.
drmovi
(Drmovi)
4
thanks for all replay
my database date setup is int(11) as i store time as timestamp you will notic that i set ‘timestampAttribute’=>‘start_publish’
at last nothing works even when changing date format
notice that i’ve checked the posted parameter to ensure posting date in the proper format and it is
any idea ?
drmovi
(Drmovi)
5
hay i’ve found what’s error
i changed date format with a code after massive assignment of the form so it’s delivered in timestamp before validation
thanks for all