Menu

#2 What about using legend/fieldset/labels

open
None
5
2006-10-05
2006-09-24
No

I tend to do this for my forms, instead of using tables:
<fieldset>
<legend>Event Information</legend>
<label jwcid="@FieldLabel" field="component:name" for="name"
accesskey="n">Event name </label>
<input jwcid="name" size="35" type="text" name="name" id="name"
tabindex="1"/><br />
</fieldset>

Basically, each section of dividable data (and there can be more than one
for a long form) use fieldsets with a legend label, that gets rendered via
css. Adding in an option like this would be very cool.

Discussion

  • Daniel Gredler

    Daniel Gredler - 2006-09-24
    • assigned_to: nobody --> sdanig
     
  • Daniel Gredler

    Daniel Gredler - 2006-09-24

    Logged In: YES
    user_id=1109422

    BeanForm already builds labels for all your inputs.

    If you want the form contents to be inside a fieldset (with
    an optional legend), you can just surround the BeanForm with
    a fieldset.

     
  • Warner R. Onstine

    Logged In: YES
    user_id=5112

    Not exactly what I was talking about, more along the lines of the <li> output
    option, removing the unnecessary table for the form fields.

     
  • Daniel Gredler

    Daniel Gredler - 2006-09-25

    Logged In: YES
    user_id=1109422

    Ah. In that case you can follow the li/ul example, and just
    specify element="div" or element="span" instead of
    element="li" or element="ul". You get more divs and/or spans
    than in your example, but I think that's what you're looking
    for.

    Or did you already know you could accomplish what you want,
    and just want the default table rendering to change to a
    non-table based layout?

     
  • Daniel Gredler

    Daniel Gredler - 2006-10-01
    • labels: 867472 -->
    • status: open --> closed
     
  • Daniel Gredler

    Daniel Gredler - 2006-10-01

    Logged In: YES
    user_id=1109422

    No answer, assuming resolved.

     
  • Warner R. Onstine

    Logged In: YES
    user_id=5112

    Yeah, that's close, but I would definitely like it as an option rather than having it
    output multiple fields that the browser has to deal with instead of just the form
    itself.

    Don't know if it would be easy to tell it to split a form into logical areas, or if this
    would be necessary to do this using the override feature.

     
  • Warner R. Onstine

    • status: closed --> open
     
  • Daniel Gredler

    Daniel Gredler - 2006-10-15

    Logged In: YES
    user_id=1109422

    To get it to split the form into logical areas, as things
    stand right now, it'd probably be best to use a regular
    @Form component, and then put multiple @BeanForms inside the
    @Form, one per logical area, each of which would be enclosed
    by a fieldset tag.

    It might be possible to add some additional syntax to the
    "properties" parameter to group properties into fieldsets
    without having to use multiple @BeanForms, but I'd have to
    think about it. It would complicate things and I'm not sure
    how many people would find it useful...

     
  • Andreas Andreou

    Andreas Andreou - 2006-10-20

    Logged In: YES
    user_id=785377

    An idea is to make the properties parameter of BeanForm also
    accept an array (or list) of Strings.

    On the other hand, this functionality can be moved to a new
    BeanFormArray (or something) that would contain multiple
    BeanForms...

    But that's something that users can easily code (and
    customize) on their own... Perhaps a nice tutorial on how
    this can be done is all that is needed.

    BTW, i almost always create forms using fieldsets and
    legends these days - i just include each label and
    text-input in its own div as described by Aleksandar in
    http://www.aplus.co.yu/css/styling-form-fields/

     
  • Daniel Gredler

    Daniel Gredler - 2006-12-06

    Logged In: YES
    user_id=1109422
    Originator: NO

    Note to myself: the Django admin screens allow you to do something like this.

    http://www.djangoproject.com/documentation/tutorial2/

     

Log in to post a comment.