activeRadioButtonList and ajax. problems in FF

Hello,

this is the code i use for creating an activeRadioButtonList that should be bound to an ajax call in order to populate a select.


echo CHtml::activeRadioButtonList(

                    $model,

                    "layout_id",

                    $related,

                    array(

                        'separator'=>'',

                        'ajax'=>array(

                            'url'=>CHtml::normalizeUrl(array('/campagne/layouter')),

                            'type'=>'POST',

                            'replace'=>'#campagne_template_id'

                        ),

                        'template'=>'{label}{input}'

                    )

                );

The ajax stuff works, the problem is that the javascript code that Yii creates gives me a problem with firefox:




<script type="text/javascript">

/*<![CDATA[*/

jQuery(document).ready(function() {

jQuery('#campagne_nome').live('change',function(){jQuery.ajax({'url':location.href,'cache':false});return false;});

jQuery('#campagne_layout_id_0').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});return false;});

jQuery('#campagne_layout_id_1').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});return false;});

jQuery('#campagne_layout_id_2').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});return false;});

jQuery('#campagne_layout_id_3').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});return false;});

jQuery('#campagne_layout_id_4').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});return false;});

});

/*]]>*/

</script>



this code creates a strange behavior, the checkboxes get never changed. I found out i have to change the code to:


<script type="text/javascript">

/*<![CDATA[*/

jQuery(document).ready(function() {

jQuery('#campagne_nome').live('change',function(){jQuery.ajax({'url':location.href,'cache':false});return false;});

jQuery('#campagne_layout_id_0').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});});

jQuery('#campagne_layout_id_1').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});});

jQuery('#campagne_layout_id_2').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});});

jQuery('#campagne_layout_id_3').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});});

jQuery('#campagne_layout_id_4').live('click',function(){jQuery.ajax({'url':'/index.php?r=campagne/layouter','type':'POST','cache':false,'data':jQuery(this).parents("form").serialize(),'success':function(html){jQuery("#campagne_template_id").replaceWith(html)}});});

});

/*]]>*/

</script>

(ie: remove the return:false;) in order to get the radiobuttons working.

has enyone found out the same thing?

greetings, and thanks,

fredo

I’m having the same issue. I cannot select the items on my radio list, though the ajax is executing properly. Removing “return false” as you suggested does seem to solve the issue if I hack the raw HTML output. Note that for me this isn’t just a FF issue. It doesn’t work in IE7,8 or Chrome either.

Were you able to find a solution to this, or has anyone else encountered this issue? Is it a bug?

I believe I have solved the problem by specifying " ‘return’=>true " in htmlOptions


CHtml::activeRadioButtonList($model, 'user_id', $data, array('ajax'=>array( 'type'=>'POST', 'url'=>'index.php?r=user/MyController'), 'return'=>true));