Marc,
Have you considered using $form->input instead of $form->radio?
This will generate that mark-up for you, as well as creating a
fieldset too, if you require.
Something along the lines of:
<?php
echo $form->input('Options.selectPlan', array(
'div' => false,
'label' => true,
'type' => 'radio',
'options' => array(1 => 'Plan 1', 2 => 'Plan 2')
);
?>
On Sep 21, 2:57 am, 1Marc <[EMAIL PROTECTED]> wrote:
> Once again I answered my own question, here is what I did:
>
> <?php
> class AppHelper extends Helper {
>
> function __construct(){
> $this->tags['radio'] = '<input type="radio" name="data[%s]
> [%s]" id="%s" %s /><label for="%3$s">%s</label>';
> parent::__construct();
> }}
>
> ?>
>
> On Sep 20, 10:33 am, 1Marc <[EMAIL PROTECTED]> wrote:
>
> > Let me clarify. I need some way for the radio buttons to generate
> > labels.
>
> > Currently the $form->radio generates:
>
> > <input name="radios" id="radio1" value="1" type="radio" />Option 1
> > <input name="radios" id="radio2" value="2" type="radio" />Option 2
> > <input name="radios" id="radio3" value="3" type="radio" />Option 3
>
> > Here is the proper markup I want to generate:
>
> > <input name="radios" id="radio1" value="1" type="radio" /><label
> > for="radio1">Option 1</label>
> > <input name="radios" id="radio2" value="2" type="radio" /><label
> > for="radio2">Option 2</label>
> > <input name="radios" id="radio3" value="3" type="radio" /><label
> > for="radio3">Option 3</label>
>
> > On Sep 20, 9:55 am, 1Marc <[EMAIL PROTECTED]> wrote:
>
> > > I figured out that you can do this and it solves my issue.
>
> > > <?php echo $form->radio('Options.selectPlan',array('1'=>'Monthly
> > > $35'),null,array()) ?>
> > > *html goes here
> > > <?php echo $form->radio('Options.selectPlan', array('2'=>'Monthly
> > > $33.25'),null,array()) ?>
>
> > > ...etc
>
> > > I still can't figure out how to automatically generate labels for
> > > radio buttons. Does anyone know how to do this?
>
> > > On Sep 19, 6:50 pm, 1Marc <[EMAIL PROTECTED]> wrote:
>
> > > > What if I only want to create one individual radio button? In CakePHP
> > > > 1.2, $form->radio creates a set of radio widgets.
>
> > > > In my case I have 8 radio buttons spread out through a results table
> > > > that you can only select one. The 'in between text' doesn't cut it.
> > > > - I will create these radio buttons by hand unless there is a handy
> > > > way to create an individual radio button instead of a radio group.
>
> > > > Thanks for your help on this,
>
> > > > ~Marc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---