Code snippets for symfony 1.x

Navigation

How to check radiobutton after post.

The boolean is set to The third argument.

<?php echo radiobutton_tag('status', 'value1', true) ?>
<?php echo radiobutton_tag('status', 'value2', false) ?>

It write like this.

<?php echo radiobutton_tag("status", "value1", $sf_params->get("status") == 'value1'); ?>
<?php echo radiobutton_tag("status", "value2", $sf_params->get("status") == 'value2'); ?>
by Kota Sakoda on 2006-08-30, tagged forms  view 

Comments on this snippet

gravatar icon
#1 Francois Zaninotto on 2006-11-21 at 10:06

How about using the fillin feature? It does it all for you.

gravatar icon
#2 Kota Sakoda on 2007-01-24 at 07:44

At that time, I did not notice it.

gravatar icon
#3 Stephen Riesenberg on 2007-02-03 at 05:54

Francois, is there a particular reason why symfony doesn't have radiobutton_array and checkbox_array helpers in FormHelper.php? Is it just too hard to generalize or something? This type of task would be very easy to do with a helper like that.