Saturday, May 2, 2009

Re: Buggy radio buttons using Form Helper?

instead of label, try to set 'legend'=>'my fieldset legend'

On Apr 30, 5:42 pm, Martin Westin <martin.westin...@gmail.com> wrote:
> Hi,
> I was playing with radio.-buttons today. (rarely used form element in
> my work)
>
> I think it is strage if this is a proper bug but radio buttons seem to
> be missing seem of the magic of other elements. Am  doing something
> staggeringly wrong here?
>
> echo $form->input('spelling_important', array(
>     'type'=>'radio',
>     'options'=>$required_variable,
>     'label'=>'this does nothing',
>     'empty'=>'this does nothing either'
> ));
>
> 1. The naming (first argument to input) makes a lot of difference.
> Calling the input "fieldname" I get no "label" for the whole group.
> Calling it "Modename.fieldname" and "Fieldname" will apear in front of
> the group in the resulting html.
>
> 2. The key "label" does nothing as far as I can see. Not even to
> replace the above auto-label.
>
> 3. The key "options" is required. If I leave out type=>radio the same
> tag will automagically pick up on the set variable of the same name as
> the fieldname given. E.g. setting $houses and calling the input houses
> will fill the select with options from the variable. Not so when  the
> type is set to radio.
>
> 4. The key "empty" does nothing even though it can be very useful
> since you can "uncheck" a radio button.
>
> The first thing I found was just a bit strange but the rest of it is
> really an inconsistency with the select input-type. Since they
> generally can serve the same logical purpose I expect them to work the
> same but they don't for some reason. Anyone know why?
>
> (I haven't checked these things with checkboxes yet)
> /Martin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: