>I have the following clay composite: > ><component jsfid="requiredInputText" extends="inputText"≶ > <validator jsfid="commonsValidator"≶ > <attributes≶ > <set name="client" value="false" /≶ > <set name="server" value="true" /≶ > <set name="type" value="required" /≶ > </attributes≶ > </validator≶ ></component≶ > >This enables me to do the following and get validation for free: > ><component jsfid="lastName" extends="requiredInputText"≶ > <attributes≶ > <set name="value" value="#{myBean.lastName}" /≶ > </attributes≶ ></component≶ > > >Now I want to add an associated jsf message component right next to the >inputText in a reusable way - like I was able to do with the validator. > >For example, > ><component jsfid="requiredInputPanel" extends="panelGroup"≶ > <element renderId="1" jsfid="requiredInputText"/≶ > <element renderId="2" jsfid="message"≶ > <attributes≶ > <set name="for" value="?"/≶ > <set name="styleClass" value="errors"/≶ > </attributes≶ > </element≶ ></component≶ > >First question, if there any way in clay to support matching the for >attribute of the message above with the dynamically assigned id from the >requiredInputText? >
You must explicitly define the id's. Id's can be defined on the component or element. <component jsfid="lastName" extends="requiredInputText" id="lastName" ≶ <attributes≶ <set name="value" value="#{myBean.lastName}" /≶ </attributes≶ </component≶ *And/OR* <component jsfid="requiredInputPanel" extends="panelGroup"≶ <element renderId="1" jsfid="requiredInputText" id="lastName" /≶ <element renderId="2" jsfid="message"≶ <attributes≶ <set name="for" value="lastName"/≶ <set name="styleClass" value="errors"/≶ </attributes≶ </element≶ </component≶ >Second question, can I define a component that extends requiredInputPanel >and overrides the value attribute of the nested requiredInputText? > The inheritance only has the capability of overriding attributes of the parent and contained elements. Overriding an element will replace the element. The "signature" for inheritance is the renderId of the element. There is not a way to override an attribute "horizontally" meaning you cannot specify a jsfid that represents containment similar to the generated clientId of the JSF component. "myPanel/lastName/validator/validator1" I might be interesting think about being able to apply customizations to a subtree "horizontally". This would allow you to slip in an override without restructuring the hierarchy of the inheritance. Challenge would be creating/requiring a unique id to represent containment. IdÂ’s generated by the component could not be correlated to the metadata component id's. In short, the only way to override a validator of an element of an extended component would be to replace the element. <component jsfid="requiredInputPanel" extends="panelGroup"≶ <element jsfid="inputText" renderId="1" id="lastName" ≶ <validator jsfid="commonsValidator"≶ <attributes≶ <set name="client" value="false" /≶ <set name="server" value="true" /≶ <set name="type" value="required" /≶ </attributes≶ </validator≶ </element≶ <element renderId="2" jsfid="message"≶ <attributes≶ <set name="for" value="lastName"/≶ <set name="styleClass" value="errors"/≶ </attributes≶ </element≶ </component≶ >Also, any suggestions on accomplishing this are welcome. > >Thanks, >Ryan Gary --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]