Yii Framework Forum: Can't Get Two Widgets To Both Work On Form - Yii Framework Forum

Jump to content

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

Can't Get Two Widgets To Both Work On Form Rate Topic: -----

#1 User is offline   Amy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 04-February 13

Posted 19 March 2013 - 01:02 PM

I have a form with two widgets: CJuiAutoComplete and CJuiDatePicker. Either widget works fine alone on the form, but when I have them both the CJuiDatePicker starts acting like CJuiAutoComplete instead of the date picker. It doesn't matter which order I have them on the form; I get the same behavior.

Any ideas what I need to change?

Here's the AutoComplete:
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
	'model' => $model,
	'attribute' => 'street_name',
	'name' => 'street_name',
	'value' => '',
	'source' => CController::createUrl('/streetAddress/autocomplete'),
	'options' => array(
	    'minLength' => 2,
	    'select' => "js:function(event, ui) {
	        $('#<field_id>').val(ui.item.['<id>']);
	        }",
	    'change' => "js:function(event, ui) {
	        if (!ui.item) {
	            $('#<field_id>').val('');
	        }
	    }",
	),
	)); 


And here's the Date picker:
<?php
	$this->widget('zii.widgets.jui.CJuiDatePicker', array(
	'model'=>$model,
	'attribute'=>'date_taken',
	'value'=>$model->date_taken,
	// additional javascript options for the date picker plugin
	'options'=>array(
	'showAnim'=>'fold',
	'showButtonPanel'=>true,
	'autoSize'=>true,
	'dateFormat'=>'m/d/yy',
	'defaultDate'=>$model->date_taken,
	 ),
		)); 

0

#2 User is offline   Amy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 04-February 13

Posted 26 March 2013 - 11:16 PM

I must have had the syntax wrong on the autocomplete. I just simplified the autocomplete and both widgets are working fine now.
1

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