[html-formfu] Some FormFu questions from a beginner

Carl Franks fireartist at gmail.com
Wed Mar 23 10:19:18 GMT 2011


Hi!

On 23 March 2011 10:02, John M. Dlugosz <mk5h6fmfqx at snkmail.com> wrote:

> * How do I generate an id on the div that wraps the actual control? If I put
> an id in the element block of the config, it goes on the input element
> itself, and is cross referenced by the for attribute of the label, but does
> nothing to the enclosing div. And CSS can't select based on children's
> features.

See "container_attributes"
http://search.cpan.org/~cfranks/HTML-FormFu-0.08002/lib/HTML/FormFu/Element/_Field.pm#container_attributes

> * I also want to put the checkbox label to the right of the box, and the
> documented reverse_single didn't do anything to it.

I'd personally recommend using CSS to rearrange them, but if you want
to change the markup - single_reverse is the correct way.
I've just tested it, and it does work - did you check the actual
markup? Maybe your CSS was making it look like nothing had changed.
I've just committed a new test to github, so you can see how I tested
it - see the files:
    t/elements/checkbox_reverse.t
    t/elements/checkbox_reverse.yml

> * On a related note, how do I make the checkbox initially checked when the
> form is displayed with no data? The value is already 1, and I guess that's
> what it would be if it was set. What I want to do is display a text area,
> and under that a submit button on the left, and a checkbox with "CC me" on
> the right, on the same level as the button.

$field->default(1);

or, in yaml:
    - type: Checkbox
      name: foo
      label: Foo
      default: 1

Hope this helps,
Carl



More information about the HTML-FormFu mailing list