Break Html Structure In Yii?

Im trying to use javascript but I got this problem:

in php:

echo "<input type='button' onClick='getIdbyName(\''.$a.'\');'>";

in html page, use Firebug to debug it turn to become like that:

<input type="button" '.a1.'\');'="" onclick="getPriceId(\">

So that why I cant call the javascript function. Anyone know how to fix it or another solution to use javascript?

Why don’t you use CHtml

check the blog demo

<?php echo CHtml::submitButton($model->isNewRecord ? ‘Create’ : ‘Save’); ?>

Please visit and


Example (demo+code)

The yiiplayground demo is very userful. Thank you :)