Difference between #3 and #5 of
How to display Dependent drop-down value using ajax call with dynamically

Changes

Title unchanged

How to display Dependent drop-down value using ajax call with dynamically

Category unchanged

Tutorials

Yii version changed

1.1

Tags changed

drop down list, ajax link, search, #dropdown

Content changed

[...]
**1)** First we have to create the two table and insert the some sample data




```php

CREATE TABLE `country_master` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
[...]

```php

CREATE TABLE `state_master` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
[...]

```php

<?php echo CHtml::hiddenField('hidden_state',$model->state);?>
```
[...]

```php
<div class="control-group"> <?php echo $form->label($model,'country',array('class'=>'control-label')); ?> <div class="controls"> <?php echo $form->dropDownlist($model,'country',UtilityHtml::getCountryData($model->country), array('class'=>'m-wrap large tooltips','data-original-title'=>'Country'),
'ajax' => array(
'type'=>'POST',
[...]

```php

<div class="control-group">
<?php echo $form->label($model,'state',array('class'=>'control-label')); ?>
[...]

```php

public function actionDynamicStates()
{
[...]

```php

class UtilityHtml extends CHtml{
[...]

```php

<?php
Yii::app()->clientScript->registerScript('countryload','jQuery(function($) {
$("#VkUsers_country").trigger("change");
$("#VkUsers_state").val(\''.$model->state.'\');
});
[...]
1 1
6 followers
Viewed: 49 841 times
Version: 1.1
Category: Tutorials
Written by: Ankit Modi
Last updated by: samdark
Created on: Jul 23, 2014
Last updated: 5 years ago
Update Article

Revisions

View all history