Wednesday, August 17, 2011

Re: formatting radio buttons

The problem I find is that the default HTML output from the Form
Helper is difficult to style with CSS.

Try changing your code to:
<?php
$options=array('M'=>'Male','F'=>'Female');
$attributes=array(
'legend'=>false,
'between'=>'<ul><li>',
'after'=>'</li></ul>',
'separator'=>'</li><li>'
);
echo $this->Form->radio('gender',$options,$attributes);
?>

This should output your radio options in an unorderded list which is
much easier to style with CSS.

HTH, Paul.

On Aug 16, 8:41 am, luca capra <luca.ca...@gmail.com> wrote:
> Can't you use css ?
>
> On 16/08/2011 09:38, Tomfox Wiranata wrote:
>
>
>
>
>
>
>
> > hi,
>
> > cake offers this great forms helper. when i add several radio buttons,
> > they appear in line.
>
> > <?php
> > $options=array('M'=>'Male','F'=>'Female');
> > $attributes=array('legend'=>false);
> > echo $this->Form->radio('gender',$options,$attributes);
> > ?>
>
> > how can i make them list one below the other? i tried to insert<br>
> > in the array, didnt work...sorry, for that dumb question.......but
> > thanks :)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate