You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by scottymo <sc...@scottymo.com> on 2007/05/09 20:03:11 UTC

Re: selectOneRadio in tree2 ?

Michael,


Michael Heinen wrote:
> 
> Could anybody give me a hint how to use a selectOneRadio inside tree2?
> 
> Every node should have a radio button but only one of them should be
> selected.
> 
I was trying to get the same behavior that you describe, and my initial
attempts to use t:selectOneRadio with layout="spread", combined with t:radio
tags in the facets of my t:tree2 nodes failed. When JSF was processing the
t:radio tags, it could not find the selectOneRadio component referred to by
the "for" attribute of the t:radio tag, resulting in a "Caught exception:
IllegalStateException with the message "Could not find component
'job-select' (calling findComponent on component
'tree2-test:job-tree:0:0:0:_id26')" in my browser.

As it turns out, the key was that I needed to be more specific with the
"for" attribute of my t:radio tag; rather than simply referring to the id of
the t:selectOneRadio tag like this:
    <t:radio index="#{node.index}" for="job-select" />
I had to qualify it with the id of the h:form tag that contained
t:selectOneRadio:
    <t:radio index="#{node.index}" for=":tree2-test:job-select" />

"tree2-test" is the id for the h:form that contains the tree and
"job-select" is the id for the t:selectOneRadio tag.

This is similar to that approach recommended in the "Dynamic Example" on 
http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns this MyFaces
wiki page , except the t:radio tags are included in tree facets rather than
table cells.

The end result is that I was able to get the value of the selected radio
button in my backing bean, and use it to process the specific node that the
user had selected in the tree. I'm using Tomahawk 1.1.2 with the Sun's JSF
reference implementation 1.1_01 running on Tomcat 5.5.7.

--Scott




Following 


-- 
View this message in context: http://www.nabble.com/selectOneRadio-in-tree2---tf3657612.html#a10399609
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: selectOneRadio in tree2 ?

Posted by Michael Heinen <mh...@recommind.com>.
Thanks Scott,

I use also a t:selectOneRadio with spread layout and added an index
attribute to my nodes.
The value of the for attribute must be full qualified as you said.
This took me some time.


Michael
 


-----Original Message-----
From: scottymo [mailto:scott@scottymo.com] 
Sent: Mittwoch, 9. Mai 2007 20:03
To: users@myfaces.apache.org
Subject: Re: selectOneRadio in tree2 ?


Michael,


Michael Heinen wrote:
> 
> Could anybody give me a hint how to use a selectOneRadio inside tree2?
> 
> Every node should have a radio button but only one of them should be
> selected.
> 
I was trying to get the same behavior that you describe, and my initial
attempts to use t:selectOneRadio with layout="spread", combined with
t:radio
tags in the facets of my t:tree2 nodes failed. When JSF was processing
the
t:radio tags, it could not find the selectOneRadio component referred to
by
the "for" attribute of the t:radio tag, resulting in a "Caught
exception:
IllegalStateException with the message "Could not find component
'job-select' (calling findComponent on component
'tree2-test:job-tree:0:0:0:_id26')" in my browser.

As it turns out, the key was that I needed to be more specific with the
"for" attribute of my t:radio tag; rather than simply referring to the
id of
the t:selectOneRadio tag like this:
    <t:radio index="#{node.index}" for="job-select" />
I had to qualify it with the id of the h:form tag that contained
t:selectOneRadio:
    <t:radio index="#{node.index}" for=":tree2-test:job-select" />

"tree2-test" is the id for the h:form that contains the tree and
"job-select" is the id for the t:selectOneRadio tag.

This is similar to that approach recommended in the "Dynamic Example" on

http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns this
MyFaces
wiki page , except the t:radio tags are included in tree facets rather
than
table cells.

The end result is that I was able to get the value of the selected radio
button in my backing bean, and use it to process the specific node that
the
user had selected in the tree. I'm using Tomahawk 1.1.2 with the Sun's
JSF
reference implementation 1.1_01 running on Tomcat 5.5.7.

--Scott




Following 


-- 
View this message in context:
http://www.nabble.com/selectOneRadio-in-tree2---tf3657612.html#a10399609
Sent from the MyFaces - Users mailing list archive at Nabble.com.