You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Alessandro Polverini <al...@nibbles.it> on 2005/01/27 19:57:52 UTC

MyFaces error with x:outpuLabel

Hello,
if I use a construct like that:

<h:outputLabel for="cb1" value="Test"/>
<h:selectBooleanCheckbox id="cb1"/>

I get a warning from myfaces :
org.apache.myfaces.renderkit.html.HtmlLabelRenderer encodeBegin
WARNING: Unable to find component 'cb1' (calling findComponent on
component 'form:_id5')

The warning goes away if I reverse the order of the two lines, so I
suppose the problem is that the label looks for the selectBox before it
is added to the tree.
Maybe the right way is to define labels after other components, but this
would be a bit restrictive, anyway, if this is the case, I think all the
examples should be changed since they define labels first.

Otherwise, is this an error to report tu jira?

I'm using myfaces 1.0.8.

Thanks,
Alex



Re: MyFaces error with x:outpuLabel

Posted by Sean Schofield <se...@gmail.com>.
OK I see that this is definitely a problem with the spec.  I figured
that was the case, but that still sucks for the developer.  Well
hopefully it will be addressed in 1.2 (and hopefully 1.2 won't take
forever).

I guess the forceId example you showed me was with the "order
reversed" as Alessandro pointed out.

sean

Re: MyFaces error with x:outpuLabel

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
Sean,


>Why should that be necessary?  Does anyone know if this is a faces
>issue or something specific to MyFaces?
>  
>
as Kalle pointed out, that is also inside of RI.
Hans Bergsten wrote about this issue. It will be addressed
in JSF 1.2 or may be 2.0. I guess...

here is more:
http://www.onjava.com/pub/a/onjava/2004/06/09/jsf.html
(first page contains that...)

-Matthias

Re: MyFaces error with x:outpuLabel

Posted by Sean Schofield <se...@gmail.com>.
> Just wrap them both inside a <h:panelGroup /> and it will get rid of
> the warning.

Why should that be necessary?  Does anyone know if this is a faces
issue or something specific to MyFaces?

Also, you could use the new forceId attribute to get JSF from
tampering with your id's.  There is not an extended myfaces version of
selectOneCheckbox but I'm going to add one this week so we can add
forceId.  In the meantime, an interesting experiment is to see if it
works with

<x:outputLabel for="cb1" value="Test"/>
<x:outputText id="cb1" forceId="true" value="whatever"/>

I believe Matthias showed me an example where he did this and it
worked fine.  If this works, then you can be confident that it will
work with <x:selectBooleanCheckbox> (once I add it).

> -Heath Borders-Wing

sean

Re: MyFaces error with x:outpuLabel

Posted by Heath Borders <he...@gmail.com>.
Just wrap them both inside a <h:panelGroup /> and it will get rid of
the warning.


On Thu, 27 Jan 2005 19:57:52 +0100, Alessandro Polverini
<al...@nibbles.it> wrote:
> Hello,
> if I use a construct like that:
> 
> <h:outputLabel for="cb1" value="Test"/>
> <h:selectBooleanCheckbox id="cb1"/>
> 
> I get a warning from myfaces :
> org.apache.myfaces.renderkit.html.HtmlLabelRenderer encodeBegin
> WARNING: Unable to find component 'cb1' (calling findComponent on
> component 'form:_id5')
> 
> The warning goes away if I reverse the order of the two lines, so I
> suppose the problem is that the label looks for the selectBox before it
> is added to the tree.
> Maybe the right way is to define labels after other components, but this
> would be a bit restrictive, anyway, if this is the case, I think all the
> examples should be changed since they define labels first.
> 
> Otherwise, is this an error to report tu jira?
> 
> I'm using myfaces 1.0.8.
> 
> Thanks,
> Alex
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org