Friday, October 31, 2008

Re: Position of label on checkbox inputs

It is common practice to have labels for most form elements before
(above or to the left of) the element itself, except for radio buttons
and checkboxes, where the norm is for the label to be on the right.

[x] Bacon
[x] Eggs
[x] Sausages

easier to read than

Bacon [x]
Eggs [x]
Sausages [x]

I've never had a problem styling forms with the standard form helper
methods.

(On an unrelated note, are there any collections of CSS files for
cakephp forms? Might be a handy resource to create one. The bakery
style is ok, but a drop-in solution for columnar forms that work
directly with the form helper would be cool. A sort of "CSS Cake
Garden" if you will.)

hth
grigri

On Oct 31, 9:52 am, Tom Singer <tomsin...@gmail.com> wrote:
> Hi,
>
> Is there a reason $out is appended to the end in form->input when
> $type is set to checkbox? This behaviour is different to all the other
> types which place label before the input and is causing me issues with
> my layout. I can fix this by moving the out variable between $before
> and the checkbox but i don't want to do this if $out is at the end by
> design and this will break something. I have had no issues so far but
> this may break somethign i have not come across yet.
>
> I am using version 1.2.0.7296 RC2
>
> Thanks,
>
> Tom
>
> tom@bender:~/jobzone$ git diff cake/libs/view/helpers/form.php
> diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/
> form.php
> index 33639b2..35d06c6 100644
> --- a/cake/libs/view/helpers/form.php
> +++ b/cake/libs/view/helpers/form.php
> @@ -735,7 +735,7 @@ class FormHelper extends AppHelper {
>                                 unset($divOptions);
>                         break;
>                         case 'checkbox':
> -                               $out = $before . $this->checkbox($fieldName, $options) . $between . $out;
>
> +                               $out = $before . $out . $this->checkbox($fieldName, $options) . $between;
>
>                         break;
>                         case 'radio':
>                                 $out = $before . $out . $this-
>
> >radio($fieldName, $radioOptions, $options) . $between;
--~--~---------~--~----~------------~-------~--~----~
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: