Gary VanMatre wrote:
Hello again,

I'm trying to use the Tomahawk t:selectOneRadio and t:radio components to use the spread layout feature. Here's the clay-config.xml configuration for my component definitions:

 <component jsfid="selectPaymentType" extends="t:selectOneRadio">
   <attributes>
     <set name="id" value="paymentType" />
     <set name="value" value="[EMAIL PROTECTED]" />
     <set name="layout" value="spread" />
   </attributes>
   <element renderId="1" jsfid="selectItem">
     <attributes>
       <set name="itemLabel" value="Pay with a credit card" />
       <set name="itemValue" value="1" />
     </attributes>
   </element>
   <element renderId="2" jsfid="selectItem">
     <attributes>
       <set name="itemLabel" value="Pay with a certificate" />
       <set name="itemValue" value="2" />
     </attributes>
   </element>
 </component>

 <component jsfid="selectPaymentTypeCreditCardOption" extends="t:radio">
   <attributes>
     <set name="for" value="paymentType" />
     <set name="index" value="0" />
   </attributes>
 </component>

 <component jsfid="selectPaymentTypeCertificateOption" extends="t:radio">
   <attributes>
     <set name="for" value="paymentType" />
     <set name="index" value="1" />
   </attributes>
 </component>

And I'm using them on the page with:

 <span jsfid="selectPaymentType" />
 <span jsfid="selectPaymentTypeCreditCardOption" />
<span jsfid="selectPaymentTypeCertificateOption" /> When I try and load the page, I'm getting an IllegalStateException saying the "for" attribute of the t:radio component isn't set:

java.lang.IllegalStateException: mandatory attribute 'for'
at org.apache.myfaces.renderkit.html.ext.HtmlRadioRenderer.renderRadio(HtmlRadioRen
derer.java:85)
at oThe configuration for the t:radio component looks alright (to my eyes at least):

   <component jsfid="t:radio" componentType="org.apache.myfaces.HtmlRadio">
       <attributes>
           <set name="id" bindingType="VB" />
           <set name="rendered" bindingType="VB" />
           <set name="binding" bindingType="VB" />
           <set name="enabledOnUserRole" bindingType="VB" />
           <set name="visibleOnUserRole" bindingType="VB" />
           <set name="for" bindingType="VB" />
           <set name="index" bindingType="VB" />
       </attributes>
   </component>

So what am I missing?

Now that's at tricky one. It turns out that the exception is from the renderering of the t:selectOneRadio component and not the t:radio. The componentType is not correct in the clay tomahawk config file. It was binding to the t:radio component and not the UISelectOne
sub class.  They have some serious reuse here.  The same renderer is
used for both components. Try the following config change: <component jsfid="t:selectOneRadio" componentType="org.apache.myfaces.HtmlSelectOneRadio" extends="baseOutput">
That mostly works. Now the page renders and the spread radio buttons are displayed where I have the <span jsfid="selectPaymentTypeCreditCardOption" /> elements, but the radio buttons are also displayed where the <span jsfid="selectPaymentType" /> element is. They're not supposed to be rendered if the layout is set to spread tho. I'll play around with it a bit today and see if I can figure out what's going on. May be a problem with the Tomahawk component itself, who knows.

Thanks,
Rich

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to