teguh11
(Teguhkrstianto)
May 2, 2012, 7:54am
1
i have a problem with CJuiDatePicker…
in create form, date picker work , but in update form, date picker didn’t work…
this is my code in _form.php
<div class="row">
<?php echo $form->labelEx($model,'date_expired'); ?>
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'model' => $model,
'attribute' => 'date_expired',
'options' => array(
'showAnim' => 'fold',
'dateFormat' => 'yy-mm-dd', // save to db format
'altField' => '#self_pointing_id',
'altFormat' => 'yy-mm-dd', // show to user format
),
'htmlOptions' => array(
'style' => 'height:20px;',
),
)); ?>
<?php echo $form->error($model,'date_expired'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'displayed_target'); ?>
<?php echo $form->textField($model,'displayed_target',array('disabled' => 'disabled')); ?>
<?php echo $form->error($model,'displayed_target'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'clicked_target'); ?>
<?php echo $form->textField($model,'clicked_target',array('disabled' => 'disabled')); ?>
<?php echo $form->error($model,'clicked_target'); ?>
</div>
</div>
teguh11
(Teguhkrstianto)
May 2, 2012, 8:06am
3
yes…
in update form, datepicker not showing, but in create form, date picker can showing…
is there any jquery in update than create?
teguh11
(Teguhkrstianto)
May 2, 2012, 8:14am
5
nothing jquery in update or create…
in _form.php, i just add javascript function.
function disableform()
{
if(document.ads_banner.status[0].checked)
{
document.getElementById('AdsBanner_date_expired').disabled = false;
document.getElementById('AdsBanner_clicked_target').disabled = true;
document.getElementById('AdsBanner_displayed_target').disabled = true;
}
else
{
document.getElementById('AdsBanner_date_expired').disabled = true;
document.getElementById('AdsBanner_clicked_target').disabled = false;
document.getElementById('AdsBanner_displayed_target').disabled = false;
}
}
I think this has no effect in create and update
teguh11
(Teguhkrstianto)
May 2, 2012, 8:55am
6
when i inspect using firebug, class="hasDatepicker" remove from update.
why class="hasDatepicker" can be remove?
teguh11:
when i inspect using firebug, class="hasDatepicker" remove from update.
why class="hasDatepicker" can be remove?
From what you describe, it seems the JavaScript code that you’ve added causes a problem. As a matter of fact, CJuiDatePicker is a wrapper for a jQuery UI plugin that is instantiated in JavaScript (and adds the “hasDatepicker” class).
If there’s some JavaScript error, the browser generally stops code execution. It may explain why the jQuery UI instance is not tied with your input field.
Anyway, here are two pointers:
[list=1]
[*]Can you see in Firebug any JavaScript error (check the console tab, and/or some number next to a [color="#FF0000 "]x[/color] sign in the status bar)?
[*]Does removing your custom JavaScript code solve the problem?
[/list]
softark
(Softark)
May 2, 2012, 10:30am
9
You might have disabled the target text field of the date picker when updating.
teguh11
(Teguhkrstianto)
May 3, 2012, 3:41am
10
From what you describe, it seems the JavaScript code that you’ve added causes a problem. As a matter of fact, CJuiDatePicker is a wrapper for a jQuery UI plugin that is instantiated in JavaScript (and adds the “hasDatepicker” class).
If there’s some JavaScript error, the browser generally stops code execution. It may explain why the jQuery UI instance is not tied with your input field.
Anyway, here are two pointers:
[list=1]
[*]Can you see in Firebug any JavaScript error (check the console tab, and/or some number next to a [color="#FF0000 "]x[/color] sign in the status bar)?
[*]Does removing your custom JavaScript code solve the problem?
[/list]
but in create, i use the same form…
and create can showing datepicker…
and update can’t showing datepicker.
now, i remove javascript, but no effect in update