using onblur at a new textfield (out of model)

Hi, i wanna ask about onblur function that will be added into a new textfield, which out of the model?

Really need an inspiration

Thanks :lol:

Will this inspire you? :P Lol

<?php echo CHtml::activeTextField($model, ‘content’, array(‘class’ => ‘content’)); ?>

<?php

Yii::app()->clientScript->registerCoreScript(‘jquery’);

Yii::app()->clientScript->registerScript(‘effect’, "

$(document).ready(function() {

&#036;('input.content').blur(function() {


     alert(&#036;(this).val())


});

});

", CClientScript::POS_END);

?>

hehe, thanks for suggestion, rookie84…

actually i want that new textfield is filled by the other attributes in the other model.

here’s my code

in Controller





public function actionCekProp ()

	{

		$cekprop=$_GET['cekprop'];

		$sql=master_prop::model()->findAllByAttributes(array('kode_prop'=>$cekprop));

		foreach ($sql as $i)

		{

			echo $i->propinsi;

		}

	}



in _form





<script type='text/javascript' src="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery.js" ></script>


<script type="text/javascript">

		$(document).ready(function(){

			$("#dokumen_kode_prop").blur(function(){

				var cekprop = $("#dokumen_kode_prop").val();

				$.ajax({

					url: "<?php echo Yii::app()->createUrl('dokumen/cekprop')?>",

					data: "cekprop=" + cekprop,

					success: function(data){

						$("#dokumen_prop").html(data);

				}

			});

		});

	});

</script>


<div class="form">


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

	'id'=>'dokumen-form',

	'enableAjaxValidation'=>false,

)); ?>

	

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

	

	

	<div class="row">

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

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

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

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

	</div>

	

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


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



but actually, it still won’t be appeared into $prop… Thanks so much for yr respon again :lol:

It’s clearly solved. I did a mistake with .html() which should be changed with .val()…

:rolleyes:

It is difficult to suggest anything when I don’t know about the context you are working on. Here’s my suggestion anyway:

Try Firebug or anything like that to see if you form is actually send results.

Try success: function(data) { alert(data); } to see you are actually getting the data

Do console.log to see the results in your firebug.

:D , I’m so sorry for making you confuse with my question, cause I thought i’ve said my context before my coding… ^^'v

Thanks for yr suggestion, rookie84