Yii Framework Forum: Validation of DatePicker from Zii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Validation of DatePicker from Zii Using 'zii.widgets.jui.CJuiDatePicker' Widget Rate Topic: -----

#1 User is offline   Locke 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 08-December 09

Posted 12 January 2010 - 05:25 AM

Hi ,
How can i impose validation on a field
when using 'zii.widgets.jui.CJuiDatePicker' Widget
as input . when i use
CHtml::activeTextField($model,'DateStartedRide');

i get validation , but when using this instead i don't
$this->widget('zii.widgets.jui.CJuiDatePicker', array(    
    'name'=>'user[DateStartedRide]',
        'model'=>$model, 
        'options'=>array(
           'showAnim'=>'clip',
           'dateFormat'=>'yy/mm/dd',
         ),
        'htmlOptions'=>array(
           'class'=>'inputBox',
         ),
));


Any ideads ?
0

#2 User is offline   waterloomatt 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 545
  • Joined: 09-April 10

Posted 12 April 2010 - 12:00 AM

Try setting the 'value' property.

$this->widget('zii.widgets.jui.CJuiDatePicker', array(    
    'name'=>'user[DateStartedRide]',
        //'model'=>$model, 
        'value'=>$model->DateStartedRide,
        'options'=>array(
           'showAnim'=>'clip',
           'dateFormat'=>'yy/mm/dd',
         ),
        'htmlOptions'=>array(
           'class'=>'inputBox',
         ),
));


View PostLocke, on 12 January 2010 - 05:25 AM, said:

Hi ,
How can i impose validation on a field
when using 'zii.widgets.jui.CJuiDatePicker' Widget
as input . when i use
CHtml::activeTextField($model,'DateStartedRide');

i get validation , but when using this instead i don't
$this->widget('zii.widgets.jui.CJuiDatePicker', array(    
    'name'=>'user[DateStartedRide]',
        'model'=>$model, 
        'options'=>array(
           'showAnim'=>'clip',
           'dateFormat'=>'yy/mm/dd',
         ),
        'htmlOptions'=>array(
           'class'=>'inputBox',
         ),
));


Any ideads ?

0

#3 User is offline   Mohamed Y. 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 01-January 11

Posted 22 January 2011 - 12:03 PM

Didn't work for me.
:(

View Postwaterloomatt, on 12 April 2010 - 12:00 AM, said:

Try setting the 'value' property.

$this->widget('zii.widgets.jui.CJuiDatePicker', array(    
    'name'=>'user[DateStartedRide]',
        //'model'=>$model, 
        'value'=>$model->DateStartedRide,
        'options'=>array(
       	'showAnim'=>'clip',
       	'dateFormat'=>'yy/mm/dd',
     	),
        'htmlOptions'=>array(
       	'class'=>'inputBox',
     	),
));




0

#4 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 22 January 2011 - 01:18 PM

Use model/attribute pairs:

$this->widget('zii.widgets.jui.CJuiDatePicker', array(    
        'attribute'=>'DateStartedRide',
        'model'=>$model, 
        'options'=>array(
           'showAnim'=>'clip',
           'dateFormat'=>'yy/mm/dd',
         ),
        'htmlOptions'=>array(
           'class'=>'inputBox',
         ),
));


0

#5 User is offline   slabonart 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 13-April 13

Posted 30 June 2014 - 02:32 PM

Hi, did You solve this?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users