Multiple ajax submits

Hello folks!

First of all: Thx for a new great framework!

I loved PRADO, hated to see it go, knew why it had to go and now 'am fully loaded for Yii.

Now i need your help. I hope I can explain my problem…

I just simply wanted to create a small form where you can add people (represented by nameLast and nameFirst) to a friendlist - clubbing stuff  ;)

My way was to try it the AJAX way: I have a view which contains the form and a list with all currently added people and in the controller I have the corresponding action.

Now I'm tring to submit the form with the ajaxSubmitButton which just works fine … but only once. The <div> in the view get's updated and as i click the button a second time … nothing happens. Firebug shows no new GET-result at all.

Is it a problem that I re-render the whole form including the ajaxSubmitButton or is it a problem that my view is embedded in an other view? (Like site/event is the event page with a view event.php called via render('event') an in the view i have a renderPartitial('friendlist') where friendlist.php is just an other view)

Or is my way simply impossible?

Thanks for your Help!

What you encountered is an issue reported and explained at…es/detail?id=38

A quick solution to this issue is to use a unique ID for the button for each ajax result. Of course we will also try to find a better more systematic solution to this issue.

Qiang, thank you so much - for all!

Work's like a charm now.

Btw, it says "Status fixed" in the issue? Am i missing something?

Well I searched the forum (and by searching i mean clicking through all 9 pages  ;D) and found nothing. But i never had the idea of looking through issue reports. Will think of that next time.

Oh, and I know: PRADO isn’t gone. But, well, you know like things are - you can’t sell it to the clients anymore. :)

Just so I understand correctly, shouldn’t the following form work for multiple ajax form requests ?

Submit button’s ‘id’ is set to something random every time. It still doesn’t work for me?

(Using Yii from svn trunk)

It works for the first time, and I can see in firebug that the form’s HTML is updated and the button get’s a new ID. But after that it doesn’t work.

<div class="yiiForm" id="addMaterialForm" style="border: thin solid black;">

<?= CHtml::beginForm(); ?>

<?= CHtml::errorSummary($model); ?>

<div class="simple">

<?= CHtml::activeLabelEx($model,'name'); ?>

<?= CHtml::activeTextField($model,'name'); ?>


<div class="action">

<?= CHtml::ajaxSubmitButton('Create', CHtml::normalizeUrl(array('material/create')),

        array( // AJAX options

            'replace' => '#addMaterialForm',


        array( // HTML options

            'id' => 'material' . rand(),


    ); ?>


<?= CHtml::endForm(); ?>


Is this still the best way the solve the problem? There isn’t a better solution yet?

I have the same issue, and for now the best solution is to give a unique id.