Dependant Dropdown Error Cannot Be Left Blank In Yii

I have made 2 dependant dropdown in yii which works fine. But, even after selecting values from dropdown list, when i submit(create) form, Its showing below error :

Please fix the following input errors:

Taluk cannot be blank.

District cannot be blank .

And values are not inserting into the database. I have followed Everithing given in My link and My link

Here is my code in view(_form.php) :


<div class="row"> 

    <?php                                   

        echo CHtml::dropDownList('district_id','',

        array(4=>'Gulbarga',3=>'Bangalore Urban'),

        array(

            'prompt'=>'Select District',

            'ajax' => array(

                'type'=>'POST', 

                'url'=>CController::createUrl('loadTaluk'),

                'update'=>'#taluk_id', 

                'data'=>array('district_id'=>'js:this.value'),

            ))); 

            echo CHtml::dropDownList('taluk_id','', array(), array('prompt'=>'Select a Taluk'));

    ?>

</div>

in my InquiriesController.php :


public function actionLoadTaluk()

    {

        $data=Taluk::model()->findAll('district_id=:district_id',

        array(':district_id'=>(int) $_POST['district_id']));

        $data=CHtml::listData($data,'taluk_id','name');

        echo "<option value=''>Select a Taluk</option>";

        foreach($data as $value=>$name)

        echo CHtml::tag('option', array('value'=>$value),CHtml::encode($name),true);

    }

Here is my Model(Inquiries.php) :


<?php

public function rules()

    {   

        return array(

            array('organization, aplication_type, contact_person, pan, city_town_village, taluk_id, district_id', 'required'),

            array('organization, email', 'length', 'max'=>200),

            array('aplication_type, contact_person, pan', 'length', 'max'=>100),

            array('phone', 'length', 'max'=>60),

            array('address', 'length', 'max'=>150),

            array('pin_code', 'length', 'max'=>6),

            array('city_town_village', 'length', 'max'=>128),

            array('taluk_id, district_id', 'length', 'max'=>10),

            array('inquiry_id, organization, aplication_type, contact_person, email, phone, pan, address, pin_code, city_town_village, taluk_id, district_id', 'safe', 'on'=>'search'),

        );

    }

public function relations()

    {

        return array(

            'taluk' => array(self::BELONGS_TO, 'Taluk', 'taluk_id'),

        );

    }

public function attributeLabels()

    {

        return array(

            'inquiry_id' => 'Inquiry',

            'organization' => 'Organization',

            'aplication_type' => 'Aplication Type',

            'contact_person' => 'Contact Person',

            'email' => 'Email',

            'phone' => 'Phone',

            'pan' => 'Pan',

            'address' => 'Address',

            'pin_code' => 'Pin Code',

            'city_town_village' => 'City Town Village',

            'taluk_id' => 'Taluk',

            'district_id' => 'District',

        );

    }

public function search()

    {

        $criteria=new CDbCriteria;

        $criteria->compare('inquiry_id',$this->inquiry_id,true);

        $criteria->compare('organization',$this->organization,true);

        $criteria->compare('aplication_type',$this->aplication_type,true);

        $criteria->compare('contact_person',$this->contact_person,true);

        $criteria->compare('email',$this->email,true);

        $criteria->compare('phone',$this->phone,true);

        $criteria->compare('pan',$this->pan,true);

        $criteria->compare('address',$this->address,true);

        $criteria->compare('pin_code',$this->pin_code,true);

        $criteria->compare('city_town_village',$this->city_town_village,true);

        $criteria->compare('taluk_id',$this->taluk_id,true);

        $criteria->compare('district_id',$this->district_id,true);

        return new CActiveDataProvider($this, array(

            'criteria'=>$criteria,

        ));

    }

public static function model($className=__CLASS__)

    {

        return parent::model($className);

    }

}

Somebody Help me Pleaseā€¦ Thank you in advance.

Follow this wiki post -

http://www.yiiframework.com/wiki/739/how-to-display-dependent-drop-down-value-using-ajax-call-with-dynamically/