FAQ
Hi,

One of the things that my HTML coders keep telling me about formfu is
that they want to create "block" elements that can be nested. A simple
example is something like

- type: block
tag: div
elements:
- type: block
tag: span
content: foo

that would produce <div><span>foo</span></div> taking this further, it
would be nice if you can specify a text block of sorts:

- type: block
tag: div
elements:
- type: plaintext
content: foo
- type: block
tag: span
content: bar
- type: plaintext
content: baz

Which would produce <div>foo<span>bar</span>baz</div>
This would mainly be used to generate HTML content that goes within a
form, like warnings or notes about the form inputs.

Does this sound reasonable?

--d

Search Discussions

  • Carl Franks at Jul 5, 2007 at 10:00 am

    On 04/07/07, Daisuke Maki wrote:
    One of the things that my HTML coders keep telling me about formfu is
    that they want to create "block" elements that can be nested. A simple
    example is something like

    - type: block
    tag: div
    elements:
    - type: block
    tag: span
    content: foo

    that would produce <div><span>foo</span></div> taking this further, it
    would be nice if you can specify a text block of sorts:

    - type: block
    tag: div
    elements:
    - type: plaintext
    content: foo
    - type: block
    tag: span
    content: bar
    - type: plaintext
    content: baz

    Which would produce <div>foo<span>bar</span>baz</div>
    This would mainly be used to generate HTML content that goes within a
    form, like warnings or notes about the form inputs.

    Does this sound reasonable?
    I've changed the templates so that if the block's tag() is undef, the
    start and end tags aren't rendered.

    I've also added a new 'src' element which is a subclass of block.pm,
    and it simply undef's the tag() for you.
    You can use it's inherited content(), content_xml() and elements()
    methods as usual.

    So your example could be written like so:

    - type: block
    tag: div
    elements:
    - type: src
    content: foo
    - type: block
    tag: span
    content: bar
    - type: src
    content: baz

    Cheers,
    Carl
  • Daisuke Maki at Jul 5, 2007 at 10:07 am
    Oooh, nice!
    fireartist++

    I'll upgrade my templates tonight. thanks!

    --d

    Carl Franks wrote:
    On 04/07/07, Daisuke Maki wrote:

    One of the things that my HTML coders keep telling me about formfu is
    that they want to create "block" elements that can be nested. A simple
    example is something like

    - type: block
    tag: div
    elements:
    - type: block
    tag: span
    content: foo

    that would produce <div><span>foo</span></div> taking this further, it
    would be nice if you can specify a text block of sorts:

    - type: block
    tag: div
    elements:
    - type: plaintext
    content: foo
    - type: block
    tag: span
    content: bar
    - type: plaintext
    content: baz

    Which would produce <div>foo<span>bar</span>baz</div>
    This would mainly be used to generate HTML content that goes within a
    form, like warnings or notes about the form inputs.

    Does this sound reasonable?
    I've changed the templates so that if the block's tag() is undef, the
    start and end tags aren't rendered.

    I've also added a new 'src' element which is a subclass of block.pm,
    and it simply undef's the tag() for you.
    You can use it's inherited content(), content_xml() and elements()
    methods as usual.

    So your example could be written like so:

    - type: block
    tag: div
    elements:
    - type: src
    content: foo
    - type: block
    tag: span
    content: bar
    - type: src
    content: baz

    Cheers,
    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphtml-formfu @
categoriesperl, catalyst
postedJul 4, '07 at 3:53p
activeJul 5, '07 at 10:07a
posts3
users2
websitemetacpan.org...

2 users in discussion

Daisuke Maki: 2 posts Carl Franks: 1 post

People

Translate

site design / logo © 2022 Grokbase