This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Form layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Form layout" Watch "Form layout" New topic
Author

Form layout

Marco Noronha
Ranch Hand

Joined: Oct 30, 2012
Posts: 50
Guys, I´m using a panelGrid with 2 columns for my forms...
it looks ok... Something like:



But There´s some fields that CAN stay on the same "row"... because they´re small fields..
Like:
"begin date" - "end date".

I m trying to put them on the same row inside the panelGrid, but isn´t looking pretty...
Something like...

This was my last try... and it isn´t the best! lol


Here´s some tries:

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

I'm not sure if this is what you're looking for, but the h:panelGroup element can be used to bundle up multiple items and have them all appear within the same cell.


Customer surveys are for companies who didn't pay proper attention to begin with.
Marco Noronha
Ranch Hand

Joined: Oct 30, 2012
Posts: 50
Yeah, but now its ugly..
and the form has much more code:



and still looks ugly:
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You can tidy up the layout some by using embedded panelGrids instead of panelGroup. Especially if you define columnClasses to control cell widths and thus keep things better aligned.
Marco Noronha
Ranch Hand

Joined: Oct 30, 2012
Posts: 50
Tim Holloway wrote:You can tidy up the layout some by using embedded panelGrids instead of panelGroup. Especially if you define columnClasses to control cell widths and thus keep things better aligned.


Ok, I´ll try that! thanks!
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
This is something we would do in our application with colspan. Is that an outmoded approach?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Dennis Deems wrote:This is something we would do in our application with colspan. Is that an outmoded approach?


Outmoded? I don't know. But JSF doesn't do colspan. Never has. Some JSF extension tag libraries have colspan options, but the core JSF does not.
Marco Noronha
Ranch Hand

Joined: Oct 30, 2012
Posts: 50
Tim Holloway wrote:
Dennis Deems wrote:This is something we would do in our application with colspan. Is that an outmoded approach?


Outmoded? I don't know. But JSF doesn't do colspan. Never has. Some JSF extension tag libraries have colspan options, but the core JSF does not.


I ended up doing this:

panelGrid with 4 columns.

label
field
blankLabel
blankLablek

label
field
label2
field2


got it ?
But too pretty, but... its the less ugly I got!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form layout