You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Lewis <ch...@bellsouth.net> on 2008/08/11 03:04:58 UTC

T5: dynamically created form components

Hello again,

I have another issue related to the one about checkboxes that I've known
would be an issue at whatever point I needed to use dynamically created
form components. In my case I'm creating a bunch of t:checkboxes, each
representing the (un)selection of a hibernate entity. I'm currently
stuck with two issues:

1) I need an encoder, apparently. I use a loop over the entities within
a form to create the checkboxes, and T5 throws an exception saying:

Render queue error in BeginRender[info/Buyer:loop]: Error serializing
component action for component ...

Isn't tapestry-hibernate's PK encoder supposed to handle this? In an
effort I set the form to t:volatile="true", but that seems to make it
impossible to access the current object (loop's value parameter) within
the iteration, which I have. Why isn't the value encoder kicking in?

2) I need labels for the dynamic checkboxes, which means I need to know
the t:id's of them. How is this possible when looping?

Hasn't someone dealt with this?

Thanks in advance,
Chris

-- 
http://thegodcode.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: dynamically created form components

Posted by Chris Lewis <ch...@bellsouth.net>.
I found the answer to #1, mentioned in another response, and I just
found out how to have dynamically generated labels. Simply:

            <div t:type="loop" t:source="propertyTypes"
                value="propertyType" encoder="encoder">
                <t:checkbox t:id="ptype" t:value="propertyType"
t:label="prop:propertyType.name"/>
                <label t:type="label" t:for="ptype"></label>
            </div>

Notice the t:id in the checkbox and the t:for in the label. They are
"hardcoded", which I thought would throw exceptions. But no, T5 knows
they're being looped and just handles it. Awesome!

Chris Lewis wrote:
> Hello again,
>
> I have another issue related to the one about checkboxes that I've known
> would be an issue at whatever point I needed to use dynamically created
> form components. In my case I'm creating a bunch of t:checkboxes, each
> representing the (un)selection of a hibernate entity. I'm currently
> stuck with two issues:
>
> 1) I need an encoder, apparently. I use a loop over the entities within
> a form to create the checkboxes, and T5 throws an exception saying:
>
> Render queue error in BeginRender[info/Buyer:loop]: Error serializing
> component action for component ...
>
> Isn't tapestry-hibernate's PK encoder supposed to handle this? In an
> effort I set the form to t:volatile="true", but that seems to make it
> impossible to access the current object (loop's value parameter) within
> the iteration, which I have. Why isn't the value encoder kicking in?
>
> 2) I need labels for the dynamic checkboxes, which means I need to know
> the t:id's of them. How is this possible when looping?
>
> Hasn't someone dealt with this?
>
> Thanks in advance,
> Chris
>
>   

-- 
http://thegodcode.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: dynamically created form components

Posted by Robert Zeigler <ro...@scazdl.org>.
Check out https://issues.apache.org/jira/browse/TAPESTRY-2491.
The encoder in use here is the PrimaryKeyEncoder.  The encoders  
contributed by tap-hibernate are ValueEncoders.
There is currently no bridge between them.
There is also currently no way to map between the two encoder spaces.
There is also no way to "nicely" lookup a PrimaryKeyEncoder, the way  
there is with ValueEncoder.

For now, you'll need to provide your own PrimaryKeyEncoder.
It can (probably) be a wrapper around the value encoders.

Cheers,

Robert

On Aug 10, 2008, at 8/108:04 PM , Chris Lewis wrote:

> Hello again,
>
> I have another issue related to the one about checkboxes that I've  
> known
> would be an issue at whatever point I needed to use dynamically  
> created
> form components. In my case I'm creating a bunch of t:checkboxes, each
> representing the (un)selection of a hibernate entity. I'm currently
> stuck with two issues:
>
> 1) I need an encoder, apparently. I use a loop over the entities  
> within
> a form to create the checkboxes, and T5 throws an exception saying:
>
> Render queue error in BeginRender[info/Buyer:loop]: Error serializing
> component action for component ...
>
> Isn't tapestry-hibernate's PK encoder supposed to handle this? In an
> effort I set the form to t:volatile="true", but that seems to make it
> impossible to access the current object (loop's value parameter)  
> within
> the iteration, which I have. Why isn't the value encoder kicking in?
>
> 2) I need labels for the dynamic checkboxes, which means I need to  
> know
> the t:id's of them. How is this possible when looping?
>
> Hasn't someone dealt with this?
>
> Thanks in advance,
> Chris
>
> -- 
> http://thegodcode.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org