You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Riedel <ch...@gmx.net> on 2009/12/27 20:00:05 UTC

Need a workaround for having a Zone inside a Form

Hi list,

I am currently studying the sources of Tapestry to find out whether or 
not I am able to push the formSupport into the environment before the 
body of a Zone is rendered.

<t:form>

<!-- here be some control that triggers the zone update -->

<t:zone>
<t:textfield value="i.want.this.to.be.updated" >
</t:zone>

</t:form>


I know why it's not working and I've seen the code of FormInjector that 
does a pretty good job publishing the FormSupport.
Some other threads in the list about that topic were leading to no 
result... but does someone have at least a workaround or maybe an idea 
for a possible workaround? :)

Besides that, is there already an issue in JIRA for "Extending a Form 
with a Zone"? The documentation at least is mentioning it...

Cheers
Christian

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


Re: Need a workaround for having a Zone inside a Form

Posted by Christian Riedel <ch...@gmx.net>.
I think I found the corresponding JIRA: 
https://issues.apache.org/jira/browse/TAP5-351

Why has it been rejected?


Am 28.12.09 04:07, schrieb Christian Riedel:
> Hi Igor :)
>
> yes, I've seen a similar thing in the FormInjector's code.
>
> This line does (most of) the trick:
> FormSupport formSupport = 
> form.createRenderTimeFormSupport(form.getClientId(), actionSink, new 
> IdAllocator());
>
> But unfortunately the form's createRenderTimeFormSupport is in default 
> scope, so I cannot call it unless I use a component with this 
> zone-feature (or create a org.apache.tapestry5.corelib.components 
> package in my project?). In my particular case I'm dependent on a 
> radio-button, which does not have this zone parameter, yet. Maybe it 
> would be sufficient if I could call the FormSupportImpl's constructor, 
> wrapping the problematic functionality in some workaround-component:
>
> FormSupport formSupport = new FormSupportImpl(resources, name, 
> actionSink, clientBehaviorSupport,
>                 clientValidation, allocator, validationId);
> // ... then push formSupport to the environment
>
> This could be done by accessing the form's private members (as I 
> obviously need the form component's resources, etc.) ... by reflection 
> maybe? Or is there some Tapestry-Util or service doing that already? 
> There was something in the TestBase class that I could use:
>
>     Field field = findField(object.getClass(), fieldName);
>     field.setAccessible(true);
>     return field.get(object);
>
> A better approach doesn't come to my mind now. Better idea, anyone?
>
> What do you think about a JIRA requesting the implementation of the 
> zone parameter for all AbstractFields? This would be a great addition 
> to the framework IMHO.
> I'd volunteer to open and possibly contribute some time for it ;)
>
>
> Thanks,
> Christian
>
>
> Am 27.12.09 23:59, schrieb Igor Drobiazko:
>> Hi Christian,
>>
>> you can also have a look at how TAP5-138 is fixed.
>>
>> https://issues.apache.org/jira/browse/TAP5-138
>>
>> On Sun, Dec 27, 2009 at 8:00 PM, Christian Riedel
>> <ch...@gmx.net>wrote:
>>
>>> Hi list,
>>>
>>> I am currently studying the sources of Tapestry to find out whether 
>>> or not
>>> I am able to push the formSupport into the environment before the 
>>> body of a
>>> Zone is rendered.
>>>
>>> <t:form>
>>>
>>> <!-- here be some control that triggers the zone update -->
>>>
>>> <t:zone>
>>> <t:textfield value="i.want.this.to.be.updated">
>>> </t:zone>
>>>
>>> </t:form>
>>>
>>>
>>> I know why it's not working and I've seen the code of FormInjector that
>>> does a pretty good job publishing the FormSupport.
>>> Some other threads in the list about that topic were leading to no
>>> result... but does someone have at least a workaround or maybe an 
>>> idea for a
>>> possible workaround? :)
>>>
>>> Besides that, is there already an issue in JIRA for "Extending a 
>>> Form with
>>> a Zone"? The documentation at least is mentioning it...
>>>
>>> Cheers
>>> Christian
>>>
>>> ---------------------------------------------------------------------
>>> 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
>

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


Re: Need a workaround for having a Zone inside a Form

Posted by Christian Riedel <ch...@gmx.net>.
Hi Igor :)

yes, I've seen a similar thing in the FormInjector's code.

This line does (most of) the trick:
FormSupport formSupport = 
form.createRenderTimeFormSupport(form.getClientId(), actionSink, new 
IdAllocator());

But unfortunately the form's createRenderTimeFormSupport is in default 
scope, so I cannot call it unless I use a component with this 
zone-feature (or create a org.apache.tapestry5.corelib.components 
package in my project?). In my particular case I'm dependent on a 
radio-button, which does not have this zone parameter, yet. Maybe it 
would be sufficient if I could call the FormSupportImpl's constructor, 
wrapping the problematic functionality in some workaround-component:

FormSupport formSupport = new FormSupportImpl(resources, name, 
actionSink, clientBehaviorSupport,
                 clientValidation, allocator, validationId);
// ... then push formSupport to the environment

This could be done by accessing the form's private members (as I 
obviously need the form component's resources, etc.) ... by reflection 
maybe? Or is there some Tapestry-Util or service doing that already? 
There was something in the TestBase class that I could use:

     Field field = findField(object.getClass(), fieldName);
     field.setAccessible(true);
     return field.get(object);

A better approach doesn't come to my mind now. Better idea, anyone?

What do you think about a JIRA requesting the implementation of the zone 
parameter for all AbstractFields? This would be a great addition to the 
framework IMHO.
I'd volunteer to open and possibly contribute some time for it ;)


Thanks,
Christian


Am 27.12.09 23:59, schrieb Igor Drobiazko:
> Hi Christian,
>
> you can also have a look at how TAP5-138 is fixed.
>
> https://issues.apache.org/jira/browse/TAP5-138
>
> On Sun, Dec 27, 2009 at 8:00 PM, Christian Riedel
> <ch...@gmx.net>wrote:
>
>    
>> Hi list,
>>
>> I am currently studying the sources of Tapestry to find out whether or not
>> I am able to push the formSupport into the environment before the body of a
>> Zone is rendered.
>>
>> <t:form>
>>
>> <!-- here be some control that triggers the zone update -->
>>
>> <t:zone>
>> <t:textfield value="i.want.this.to.be.updated">
>> </t:zone>
>>
>> </t:form>
>>
>>
>> I know why it's not working and I've seen the code of FormInjector that
>> does a pretty good job publishing the FormSupport.
>> Some other threads in the list about that topic were leading to no
>> result... but does someone have at least a workaround or maybe an idea for a
>> possible workaround? :)
>>
>> Besides that, is there already an issue in JIRA for "Extending a Form with
>> a Zone"? The documentation at least is mentioning it...
>>
>> Cheers
>> Christian
>>
>> ---------------------------------------------------------------------
>> 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


Re: Need a workaround for having a Zone inside a Form

Posted by Igor Drobiazko <ig...@gmail.com>.
Hi Christian,

you can also have a look at how TAP5-138 is fixed.

https://issues.apache.org/jira/browse/TAP5-138

On Sun, Dec 27, 2009 at 8:00 PM, Christian Riedel
<ch...@gmx.net>wrote:

> Hi list,
>
> I am currently studying the sources of Tapestry to find out whether or not
> I am able to push the formSupport into the environment before the body of a
> Zone is rendered.
>
> <t:form>
>
> <!-- here be some control that triggers the zone update -->
>
> <t:zone>
> <t:textfield value="i.want.this.to.be.updated" >
> </t:zone>
>
> </t:form>
>
>
> I know why it's not working and I've seen the code of FormInjector that
> does a pretty good job publishing the FormSupport.
> Some other threads in the list about that topic were leading to no
> result... but does someone have at least a workaround or maybe an idea for a
> possible workaround? :)
>
> Besides that, is there already an issue in JIRA for "Extending a Form with
> a Zone"? The documentation at least is mentioning it...
>
> Cheers
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de/blog