0

After some experimenting and reading up, I found the same solution as How to reference component inside a composite component when using a converter

The problem however is that I have two IDs for the valueholder and according to the documentation I could use id1,id2 as targets but that doesn't work.

This is my composite component:

<cc:interface>
    <cc:attribute name="id" required="true"/>
    <cc:attribute name="value" required="true"/>
    <cc:attribute name="editable" required="true"/>
    <cc:editableValueHolder name="element" targets="input,output"/>
</cc:interface>
<cc:implementation>
    <h:inputText value="#{cc.attrs.value}" id="input" rendered="#{cc.attrs.editable}"/>
    <h:outputText value="#{cc.attrs.value}" id="output" rendered="#{not cc.attrs.editable}"/>
</cc:implementation>

And this is how I intend to use the CC:

<r:inputText editable="#{registrationBean.editable}" id="dateOfBirth"
             value="#{registrationBean.dateOfBirth}">
    <f:convertDateTime pattern="dd-MM-yyyy" type="date" for="element" />
</r:inputText>

I originally tried inserting the converter via insertChildren and via a facet but none worked.

Community
  • 1
  • 1
Limnic
  • 1,826
  • 1
  • 20
  • 45

1 Answers1

0

target needs to be space separated not comma separated

If present, this must be a space (not tab) separated list of client ids (relative to the top level component) of components within the section. Space is used as the delimiter for compatibility with the IDREFS and NMTOKENS data types from the XML Schema.

JSF2.2 docs

PDStat
  • 5,513
  • 10
  • 51
  • 86
  • I have tried a space as well. In fact I changed the snippet here to use a comma because the original snippet has it with space. – Limnic Oct 24 '16 at 12:41
  • Could it have to do with commented lines of code in my composite component/call site? I removed some commented code and suddenly it appears to be working. I don't yet feel safe about it but oh well... – Limnic Oct 24 '16 at 12:49