• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF SelectOneRadio and inputText

 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create a select one radio button with one option for "Other" where the user can then type input in an inputText field. This "Other" option is the last item in the list, and I am having trouble laying out the textBox to correspond with the option. Currently, the inputText box is in the middle of the second column rather than next to the "Other" selectItem. Here is my code:

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I sugges you to use Tomahawk's t:selectOneRadio component. It has an additional 'layout' attribute value, namely 'spread'. If you use it, you can place every radiobutton everywhere in the form as you want. This makes positioning easy.
 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently, I am not using Tomahawk or myFaces. I am using JSP. Is there a way to do it without Tomahawk, or is Tomahawk compatible with JSP?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uh.

Tomahawk is just a component library which adds extended components on top of basic JSF components.

Compatiblity with JSP is not an issue. It´s just a view technology.
 
eve agostini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's because you have 2 columns...in the first there is the selectoneradio and in the sencond these is the input text...anything you put inside the selectoneradio, it just stays inside that.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.. The h:selectOneRadio itself also renders a table and that´s the problem.
 
eve agostini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my answer was correct I just explained what happened.
If the h:selectOneRadio itself renders a table, that's another story. Then, maybe the problem is that Andy would like to put the h:inputText inside the table rendered by the h:selectOneRadio, rather than inside the pnel grid.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way to put the inputText in the table rendered by selectOneRadio.

That´s why I suggested to use the Tomahawk´s variant which has a layout="spread" attribute. This way the selectOneRadio doesn´t render anything but the radiobuttons and you can place the radiobuttons everywhere in the form to your taste.
 
eve agostini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bauke Scholtz wrote:There is no way to put the inputText in the table rendered by selectOneRadio.


Ok I think it's pretty correct if I call this a problem :P

Anyway I was just explaining something about how a panel grid works, which probably was not very clear to Andy.

So I just said that that was the problem, if you have a solution for it that's good.

EDIT:

By the way, if it's just a problem of layout, you could solve it by an appropriate style class
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic