While I am enjoying a conversation with myself, input from anyone using T5 and radio buttons (surely someone else) would be awesome. So I poked around a bit more in the RadioGroup source and see that, for some reason that evades me, RadioGroup creates an anonyous/ad-hoc implementation of RadioContainer on the fly, and shoves it into the environment. So, it *should* work, and in fact it does if I don't use any label components within the form. However the moment I add a <t:label/> I get the exception about no RadioContainer! Using a raw <label></label> works fine, but what in the world is going on here? I can only guess this is a bug, but input would much appreciated.

Another annoyance is the component reference. The RadioGroup lists the encoder parameter as required (and its marked as required in the source), but if I don't provide it it works anyway, so apparently a default implementation is being added somewhere. This would be fine, but as the developer I should be made aware of this. Are things like this undocumented because its all still in development?

sincerely,
chris

Chris Lewis wrote:
Ok so I learned that the id parameter must be in the t: namespace, so changing the radio component to have 't:id="reg-agent"'. Now I'm greeted with a new exception:

"No object of type org.apache.tapestry.RadioContainer is available from the Environment."

And then it lists several objects in teh environment. What's annoying is that the component ref says that the RadioGroup (or some impl of RadioContainer) must contain radio components, so my code should work. However I looked at the source for RadioGroup, and doesn't implement the RadioContainer interface!! Is this a bug?

Chris Lewis wrote:
Hello,

I'm trying to get a simple form with some radio buttons and labels working, without success. Following is the source for my Login page template and class. Note that the page is rendering in a layout component.

Login.html:
<div t:type="layouts/General" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
   <t:Form>
       <t:RadioGroup value="listerType" encoder="stringEncoder">
           <t:Label for="reg-agent">Type</t:Label>
           <t:Radio id="reg-agent" type="radio" value="listerType"/>
           <t:Radio id="reg-fsbo" type="radio" value="listerType"/>
                 </t:RadioGroup>
   </t:Form>
</div>

Login.java
public class Login {
     public static final String AGENT_LISTER="AGENT";
   public static final String AGENT_FSBO="FSBO";
   private String listerType = AGENT_LISTER;
   private StringValueEncoder stringEncoder = new StringValueEncoder();

   /**
    * @return the listerType
    */
   public String getListerType() {
       return listerType;
   }

   /**
    * @param listerType the listerType to set
    */
   public void setListerType(String listerType) {
       this.listerType = listerType;
   }

   /**
    * @return the stringEncoder
    */
   public StringValueEncoder getStringEncoder() {
       return stringEncoder;
   }
}

When I visit the page I am greeted with a "Failure reading parameter for of component listers/Login:label: Component listers/Login does not contain an embedded component with id 'reg-agent'." exception, but there is a component with id reg-agent!

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



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



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

Reply via email to