Gary VanMatre wrote:
From: Richard Wallace <[EMAIL PROTECTED]>
Hello,
I'd like to extend the inputSecret component and give the new component
an added attribute. Basically, what I want to do is create a component
that has the tomahawk equal validator attached to it. So, what I've got
now is:
<view>
<component jsfid="t:validateEqual"
componentType="org.apache.myfaces.validator.Equal">
<attributes>
<set name="for" bindingType="Early" />
</attributes>
</component>
<component jsfid="inputPasswordVerification" extends="inputSecret">
<validator jsfid="t:validateEqual">
<attributes>
<set name="for" value="password"/>
</attributes>
</validator>
</component>
</view>
What I'd like to be able to do is replace the attribute for "for" with
something more like "@for" or something so that I can use the component
like:
<input type="password" jsfid="inputSecret" id="password" />
<input type="password" jsfid="inputPasswordVerification" for="password" />
Can I add an attribute like that in clay? That would be very cool.
You should totally be able to do this using Clay. There is a very similar
example in the symbols (symbols/page3.html) usecases. There's one more layer
than you need in your example.
Includes an html template from the class path passing symbols label, property,
size, maxlenght, required and immediate.
<tr jsfid="classpath*:org/apache/shale/usecases/symbols/inputTextWidget.html" label="First Name:"
property="firstName" size="20" maxlength="30"
required="true" immediate="false"/>
The "org/apache/shale/usecases/symbols/inputTextWidget.html" template is used
for layout. It's bound to some base XML config data.
<tr>
<td><label jsfid="widgetsLabel">Mock Label:</label></td>
<td><input jsfid="widgetsText" type="text"/></td>
<td><span jsfid="widgetsMessage">Mock Message</span><td>
</tr>
The base config definitions are defined in "WEB-INF/clay-symbols-config.xml"
<component jsfid="widgetsLabel" extends="baseLabel">
<attributes>
<set name="value" value="@label" />
<set name="for" value="@property" />
</attributes>
</component>
<component jsfid="widgetsText" extends="inputText" id="@property">
<attributes>
<set name="value" value="[EMAIL PROTECTED]@property}"/>
<set name="size" value="@size" />
<set name="maxlength" value="@maxlength" />
<set name="required" value="@required" />
<set name="immediate" value="@immediate"/>
</attributes>
</component>
<component jsfid="widgetsMessage" extends="baseMessage" >
<attributes>
<set name="for" value="@property" />
</attributes>
</component>
Is the template file required? Or could I just do something like
<view>
<component jsfid="inputPasswordVerification" extends="inputSecret">
<attributes>
<set name="id" value="@id" />
<set name="required" value="@required" />
</attributes>
<validator jsfid="t:validateEqual">
<attributes>
<set name="for" value="@for"/>
</attributes>
</validator>
</component>
</view>
Or are the @ symbols only usable in the components attributes section?
I have to admit, even with the example I'm a bit lost on this one right now.
Thanks,
Rich
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]