Thank you for all the suggestions!!
I first decided to create a custom helper as per Johnathan's advice.
I started on a helper to wrap an array of radios or checkboxes in
multiple formats - divs or tables, etc. The first pitfall I ran into
was the hidden field that automatically gets created by $form-
>radio(). (My first crack at this helper created way too many hidden
fields). I'm not sure of the purpose of the hidden field, but it
became apparent that I would probably have to rewrite my own version
of $form->radio().
However, during this exploration into the Form helper code I found an
as yet unpublished attribute that solved my problem: 'Separator'.
Using 'separator' you can insert custom html in between each radio/
label combination in a radio array. Using 'separator' I did not have
to create the custom helper as planned. Here's an example of my
solution:
echo $form->input(
"Model.field",
array(
'div' => "cssClass",
'separator' => '</div><div class="cssClass">',
'label' => true,
'type' => 'radio',
'legend' => false,
'options' => array('1', '2', '3', '4')
)
);
This approx. outputs the following html:
<div class="cssClass">
<input type="hidden" name="data[Model][feild]" value="" id="domid_" /
>
<input type="radio" name="data[Model][feild]" id="domid1"
value="1" />
<label for="domid1">1</label>
</div>
<div class="cssClass">
<input type="radio" name="data[Model][feild]" id="domid2"
value="2" />
<label for="domid2">2</label>
</div>
<div class="cssClass">
<input type="radio" name="data[Model][feild]" id="domid3"
value="3" />
<label for="domid3">3</label>
</div>
I agree with everyone, the input helper is very flexible and I'm glad
I found the 'separator' option. The manual really needs to be updated
to include a description of $option['separator']. At the same time, I
could see how easy it would be to create a custom helper to output
input arrays in tables, etc. Table headings could be passed in cake
style: 'th' => array("Input", "Label", "Description"). Maybe when the
need finally presents itself...
Again, thanks for all the help guys!!
On Jul 16, 8:14 pm, "Brett Wilton" <[EMAIL PROTECTED]> wrote:
> As a further example to the form input helper you can set color and size
> information as follows :-
>
> echo $form->input('Contact.name', array('label' => array('text' => 'Name<span
> style="color:#f89e01">*</span> :'), 'size' => '25'));
>
> Hope this helps.
>
> ---
> Brett Wiltonhttp://wiltonsoftware.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---