Form - Add An Item Into Array

I have a very simple project with one model which has one element is an array. The array will be a checkboxlist In update page… When user click on a link, javascript opens a prompt for user_input then add the input into the array and display. The part I could not figure out is how can i get the value return from the javascrip. Can someone please help? Thanks.

can you please share the related code of model and update?

I cant figure out how to add/append an item to the items without submitting the form…

the button in form,

<?php echo $form->labelEx($model,‘items’); ?>

<?php echo CHtml::button(“add”,array(‘title’=>“item”,‘onclick’=>‘javascript:addItem()’); ?>

js:

function addItem() {

return 'aaaa';

}

I tried:

<?php echo CHtml::button(“add”,array(‘title’=>“item”,‘onclick’=>‘aaa = javascript:addItem()’); ?>

<?php echo $aaa; ?>

doesnt work, of course… :(