What about using legend/fieldset/labels
Brought to you by:
sdanig
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.
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.
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.
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?
Logged In: YES
user_id=1109422
No answer, assuming resolved.
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.
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...
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/
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/