Developement

hello jayant,

I need ur help. please help me. if u r free. I want to call two ajax request on selecting one drop down box.

Sorry Brother i was unable on the weekends.

you can try to call a Multiple Ajax with url by defining twoo ajax call or

you can can a function on onchange event and in this event you can call two ajax call.




Code for View File :-


<h2>Add New City</h2>


<div class="form">


	<?php $form=$this->beginWidget('CActiveForm', array(

		'id'=>'city-create-form',

		'enableAjaxValidation'=>true,

	)); ?>


		<p class="note">Fields with <span class="required">*</span> are required.</p>


		<?php echo $form->errorSummary($model); ?>


		<div class="row">

			<?php echo $form->labelEx($model,'country_id'); ?>

			<?php echo $form->dropDownList($model,'country_id',$countryList,

                    array(

                        'ajax' => array(

                        'type' => 'POST',

                        'url' => CController::createUrl('state/citystatelist'),

                        'update' => '#City_state_id'

                    ),'prompt'=>'Please Select Country'

                )

            );

           ?>

		   <?php echo $form->error($model,'country_id'); ?>

		</div>


		<div class="row">

			<?php echo $form->labelEx($model,'state_id'); ?>

			<?php echo $form->dropDownList($model,'state_id', $stateList, array('empty'=>'Please Select State'));?>

			<?php echo $form->error($model,'state_id'); ?>

		</div>


		<div class="row">

			<?php echo $form->labelEx($model,'cityname'); ?>

			<?php echo $form->textField($model,'cityname'); ?>

			<?php echo $form->error($model,'cityname'); ?>

		</div>


		<br />

		<div class="row buttons login_btn_admin">

		  <?php echo CHtml::submitButton('Submit',array("class"=>"but_bg_admin")); ?>

	    </div>


	<?php $this->endWidget(); ?>


</div><!-- form -->






public function actionCitystatelist(){

		$this->layout="";

		$country_id = $_POST['City']['country_id'];

	    $stateList = CHtml::listData(State::model()->findAll(array('order'=>'statename ASC', 'condition'=>"country_id = $country_id")), 'id', 'statename');


	   echo CHtml::tag('option',

                   array('value'=>''),CHtml::encode('Please Select State'),true);

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

        {

          echo CHtml::tag('option',

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

        }

	}




Hello,

Can anyone help me how to return an array from javascript function after button click and i want to use this array to the requested action which called by clicking the button. i.e. when i will click on button m calling a javascript function and i want this function to return an array to button and button will render an action and i want this array to use in the action rendered.

You didn’t bother reply to Jayant’s post two weeks ago, why?

Not even a ‘thank you’…

Sorry for that but I was out of station so couldnt …yes …its not an excuse.

Thanks Jayant …sorry for late.

I solved it dont bother about it…Thanks for co-operation.

Hey…its fine man…:)

your problem is solved so just cheer…!!;)

Hello to All,

I have been stuck at one place I need your help. My Problem is:

I have one cgridview which is giving the all records of one table…but what I want is to apply condition like (age=45) to the search result…How can it be done in Yii…

Thanks in Advance…