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

http://www.yiiframework.com/doc/api/1.1/CHtml

check the blog demo

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

Please visit

http://www.yiiframework.com/doc/api/1.1/CHtml and

IF using BOOTSTRAP

http://www.cniska.net/yii-bootstrap/#tbButtonGroup

http://yiibooster.clevertech.biz/

Example (demo+code)

http://www.yiiplayground.com/index.php?r=UiModule/dataview/gridViewArray

The yiiplayground demo is very userful. Thank you :)