1

I have a component inside a form:

<a:form id="myform">
   <a:somecomponent id="comp">
</a:form>

and a huge css file, which attaches some style to the component with id "comp".

However, this does not work, as in the rendered html page, the components name becomes "myform:comp".

How can I prevent this? Using myform:comp in css does not seem to work :-(

Fortega
  • 19,463
  • 14
  • 75
  • 113

3 Answers3

2

You have to add prependId="false" to form tag.

<a:form id="myform" prependId="false">
   <a:somecomponent id="comp">
</a:form>
Dejell
  • 13,947
  • 40
  • 146
  • 229
1

You just need to use the richfaces functions detailed here. #{rich:clientId(‘comp’)} can be used in this case.

Edit: also see this answer

Community
  • 1
  • 1
Adam
  • 3,675
  • 8
  • 45
  • 77
0

The best solution I found up till now is not to use the id, but the style class, and replace all of the occurences of #comp in the css file with .comp:

<a:form id="myform">
   <a:somecomponent styleClass="comp">
</a:form>

However, I don't consider this as a 'clean' solution...

Fortega
  • 19,463
  • 14
  • 75
  • 113