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 <cr...@googlemail.com> on 2011/11/06 17:11:25 UTC

[T5.3-rc-3] zone inside a form with generated ids not working

Hi,

I'm currently trying to fix some missing functionality about some cases of zone-updates in tapestry5-jquery. It seems the missing feature does also not work in a pure T5-app!

The feature I'm talking about is this: 
1. There's a link/button/whatever that can trigger a zone-update.
2. Before any update of the zone is done, a default block is rendered using the delegate component.
3. The zone-update is triggered and the zone's delegate component will render a block with some form-components.
4. The form contains a zone and a select box that may trigger another zone-update - this time it's meant to update the zone inside the form.

The moment you trigger the "show-me-the-form" zone-update you'll receive an alert message saying: 
> "Could not find zone element 'updateZone' to update on change of element 'thisValue_1337998b0f1'."

...sure because the 'updateZone' has a generated id, just like the select box. The id is in this case 'updateZone_1337998b0f1'.

I thought there's some magic in tapestry.js (the ZoneManager sounded so promising) that looks for a relative zone with the same id-postfix... but there is no such feature :-(
What do you think? Shouldn't be there such a feature? I mean, if I take the same form with the same nested zone just without the whole outer zone and block construct it just works, since there are no generated ids.

Here's what I thought should work (hope there's no copy-paste-error):

__________________________________________________________________

Index.tml (I used the archetype default app to test this):
__________________________________________________________________

<!DOCTYPE html>
<html t:type="layout" title="taptest Index"
      t:sidebarTitle="Framework Version"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
      xmlns:p="tapestry:parameter">
        <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml -->

    <p>${message:greeting}</p>

    <p>The current time is: <strong>${currentTime}</strong></p>

    <!-- A Zone is a component that can be updated in place, triggered by other components. -->
    <t:zone t:id="zone">
        <p>
            You have clicked the link <strong>${clickCount}</strong> times.
        </p>

        <p>
            [
            <t:actionlink t:id="increment">increment</t:actionlink>
            ]
            &nbsp;
            [
            <t:actionlink t:id="incrementAjax" zone="^">increment (via Ajax)</t:actionlink>
            ]
        </p>

    </t:zone>
    
    <t:zone t:id="outerZone">
        <t:delegate t:to="block" />
    </t:zone>

    <p:sidebar>
        <p>
            You are running Tapestry version <strong>${tapestryVersion}</strong>.
        </p>


        <p>
            [
            <t:pagelink page="Index">refresh page</t:pagelink>
            ]
        </p>
    </p:sidebar>
    
    <t:block t:id="emptyBlock">
        <p>empty</p>
    </t:block>

    <t:block t:id="editBlock">
        <t:form t:id="editForm">
            
            <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="updateZone" />
            
            <t:zone t:id="updateZone">
                <t:select t:id="theOtherValue" t:model="otherValues" t:value="other" blankOption="never" />
            </t:zone>
            
        </t:form>
    </t:block>

</html>

__________________________________________________________________

Index.class
__________________________________________________________________


/**
 * Start page of application taptest.
 */
public class Index
{
    @InjectComponent
    private Zone zone, updateZone, outerZone;

    @Inject
    private Block emptyBlock, editBlock;

    private Block selectedBlock;

    @Persist
    @Property
    private int clickCount;

    @Inject
    private AlertManager alertManager;

    @Inject
    private AjaxResponseRenderer ajaxResponseRenderer;

    @Property
    private List<String> selected;

    public ValueEncoder<String> getEncoder() {

        return new ValueEncoder<String>() {

            @Override
            public String toValue(String clientValue) {

                return clientValue;
            }

            @Override
            public String toClient(String value) {

                return value;
            }
        };
    }

    public List<String> getValues() {

        return Arrays.asList(new String[] {

                "asdf",
                "qwer",
                "dedede",
                "kkkkkkk"
        });
    }

    @Property
    private String other;

    public List<String> getOtherValues() {

        return Arrays.asList(new String[] {

                "Count: " + clickCount
        });
    }

    @OnEvent(component = "thisValue", value = EventConstants.SELECTED)
    void onValueSelected() {

        selectedBlock = editBlock;

        clickCount++;
        ajaxResponseRenderer.addRender(updateZone);
    }

    @SetupRender
    void setup() {

        selectedBlock = emptyBlock;

        selected = new ArrayList<String>();
        selected.add("asdf");
    }

    public Date getCurrentTime()
    {
        return new Date();
    }

    void onActionFromIncrement()
    {

        selectedBlock = editBlock;

        alertManager.info("Increment clicked");

        clickCount++;
    }

    void onActionFromIncrementAjax()
    {

        selectedBlock = editBlock;

        clickCount++;

        alertManager.info("Increment (via Ajax) clicked");

        ajaxResponseRenderer.addRender("outerZone", this.outerZone)
                            .addRender("zone", zone);
    }

    public Block getBlock() {

        return selectedBlock;
    }
}



__________________________________________________________________

Workaround:
__________________________________________________________________

Luckily, there's a workaround:
If the select's zone attribute looks like this...

> <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="prop:updateZoneId" />

... and the page code like this ...
>     public String getUpdateZoneId() {
> 
>         return updateZone.getClientId();
>     }


... then everything works as expected.

But I find this workaround quite ugly. Should I open up a JIRA? Howard, Igor, Thiago and the others - what do you think?


Regards
Christian



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


Re: [T5.3-rc-3] zone inside a form with generated ids not working

Posted by Christian Riedel <cr...@googlemail.com>.
https://issues.apache.org/jira/browse/TAP5-1746

Am 06.11.2011 um 18:04 schrieb Lenny Primak:

> Are you doing form submit via JavaScript onsubmit()?  If yes, you need to call setSubmittingElement beforehand. 
> 
> 
> 
> On Nov 6, 2011, at 11:11 AM, Christian Riedel <cr...@googlemail.com> wrote:
> 
>> Hi,
>> 
>> I'm currently trying to fix some missing functionality about some cases of zone-updates in tapestry5-jquery. It seems the missing feature does also not work in a pure T5-app!
>> 
>> The feature I'm talking about is this: 
>> 1. There's a link/button/whatever that can trigger a zone-update.
>> 2. Before any update of the zone is done, a default block is rendered using the delegate component.
>> 3. The zone-update is triggered and the zone's delegate component will render a block with some form-components.
>> 4. The form contains a zone and a select box that may trigger another zone-update - this time it's meant to update the zone inside the form.
>> 
>> The moment you trigger the "show-me-the-form" zone-update you'll receive an alert message saying: 
>>> "Could not find zone element 'updateZone' to update on change of element 'thisValue_1337998b0f1'."
>> 
>> ...sure because the 'updateZone' has a generated id, just like the select box. The id is in this case 'updateZone_1337998b0f1'.
>> 
>> I thought there's some magic in tapestry.js (the ZoneManager sounded so promising) that looks for a relative zone with the same id-postfix... but there is no such feature :-(
>> What do you think? Shouldn't be there such a feature? I mean, if I take the same form with the same nested zone just without the whole outer zone and block construct it just works, since there are no generated ids.
>> 
>> Here's what I thought should work (hope there's no copy-paste-error):
>> 
>> __________________________________________________________________
>> 
>> Index.tml (I used the archetype default app to test this):
>> __________________________________________________________________
>> 
>> <!DOCTYPE html>
>> <html t:type="layout" title="taptest Index"
>>     t:sidebarTitle="Framework Version"
>>     xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
>>     xmlns:p="tapestry:parameter">
>>       <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml -->
>> 
>>   <p>${message:greeting}</p>
>> 
>>   <p>The current time is: <strong>${currentTime}</strong></p>
>> 
>>   <!-- A Zone is a component that can be updated in place, triggered by other components. -->
>>   <t:zone t:id="zone">
>>       <p>
>>           You have clicked the link <strong>${clickCount}</strong> times.
>>       </p>
>> 
>>       <p>
>>           [
>>           <t:actionlink t:id="increment">increment</t:actionlink>
>>           ]
>>           &nbsp;
>>           [
>>           <t:actionlink t:id="incrementAjax" zone="^">increment (via Ajax)</t:actionlink>
>>           ]
>>       </p>
>> 
>>   </t:zone>
>> 
>>   <t:zone t:id="outerZone">
>>       <t:delegate t:to="block" />
>>   </t:zone>
>> 
>>   <p:sidebar>
>>       <p>
>>           You are running Tapestry version <strong>${tapestryVersion}</strong>.
>>       </p>
>> 
>> 
>>       <p>
>>           [
>>           <t:pagelink page="Index">refresh page</t:pagelink>
>>           ]
>>       </p>
>>   </p:sidebar>
>> 
>>   <t:block t:id="emptyBlock">
>>       <p>empty</p>
>>   </t:block>
>> 
>>   <t:block t:id="editBlock">
>>       <t:form t:id="editForm">
>> 
>>           <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="updateZone" />
>> 
>>           <t:zone t:id="updateZone">
>>               <t:select t:id="theOtherValue" t:model="otherValues" t:value="other" blankOption="never" />
>>           </t:zone>
>> 
>>       </t:form>
>>   </t:block>
>> 
>> </html>
>> 
>> __________________________________________________________________
>> 
>> Index.class
>> __________________________________________________________________
>> 
>> 
>> /**
>> * Start page of application taptest.
>> */
>> public class Index
>> {
>>   @InjectComponent
>>   private Zone zone, updateZone, outerZone;
>> 
>>   @Inject
>>   private Block emptyBlock, editBlock;
>> 
>>   private Block selectedBlock;
>> 
>>   @Persist
>>   @Property
>>   private int clickCount;
>> 
>>   @Inject
>>   private AlertManager alertManager;
>> 
>>   @Inject
>>   private AjaxResponseRenderer ajaxResponseRenderer;
>> 
>>   @Property
>>   private List<String> selected;
>> 
>>   public ValueEncoder<String> getEncoder() {
>> 
>>       return new ValueEncoder<String>() {
>> 
>>           @Override
>>           public String toValue(String clientValue) {
>> 
>>               return clientValue;
>>           }
>> 
>>           @Override
>>           public String toClient(String value) {
>> 
>>               return value;
>>           }
>>       };
>>   }
>> 
>>   public List<String> getValues() {
>> 
>>       return Arrays.asList(new String[] {
>> 
>>               "asdf",
>>               "qwer",
>>               "dedede",
>>               "kkkkkkk"
>>       });
>>   }
>> 
>>   @Property
>>   private String other;
>> 
>>   public List<String> getOtherValues() {
>> 
>>       return Arrays.asList(new String[] {
>> 
>>               "Count: " + clickCount
>>       });
>>   }
>> 
>>   @OnEvent(component = "thisValue", value = EventConstants.SELECTED)
>>   void onValueSelected() {
>> 
>>       selectedBlock = editBlock;
>> 
>>       clickCount++;
>>       ajaxResponseRenderer.addRender(updateZone);
>>   }
>> 
>>   @SetupRender
>>   void setup() {
>> 
>>       selectedBlock = emptyBlock;
>> 
>>       selected = new ArrayList<String>();
>>       selected.add("asdf");
>>   }
>> 
>>   public Date getCurrentTime()
>>   {
>>       return new Date();
>>   }
>> 
>>   void onActionFromIncrement()
>>   {
>> 
>>       selectedBlock = editBlock;
>> 
>>       alertManager.info("Increment clicked");
>> 
>>       clickCount++;
>>   }
>> 
>>   void onActionFromIncrementAjax()
>>   {
>> 
>>       selectedBlock = editBlock;
>> 
>>       clickCount++;
>> 
>>       alertManager.info("Increment (via Ajax) clicked");
>> 
>>       ajaxResponseRenderer.addRender("outerZone", this.outerZone)
>>                           .addRender("zone", zone);
>>   }
>> 
>>   public Block getBlock() {
>> 
>>       return selectedBlock;
>>   }
>> }
>> 
>> 
>> 
>> __________________________________________________________________
>> 
>> Workaround:
>> __________________________________________________________________
>> 
>> Luckily, there's a workaround:
>> If the select's zone attribute looks like this...
>> 
>>> <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="prop:updateZoneId" />
>> 
>> ... and the page code like this ...
>>>   public String getUpdateZoneId() {
>>> 
>>>       return updateZone.getClientId();
>>>   }
>> 
>> 
>> ... then everything works as expected.
>> 
>> But I find this workaround quite ugly. Should I open up a JIRA? Howard, Igor, Thiago and the others - what do you think?
>> 
>> 
>> Regards
>> 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: [T5.3-rc-3] zone inside a form with generated ids not working

Posted by Christian Riedel <cr...@googlemail.com>.
No, it's the plain old tapestry select-submits-onchange function.

My workaround did only work for a couple of minutes, btw.. It now seems to work like this:

I switched the order of the components in the template (first the zone, then the select)

>     <t:block t:id="editBlock">
>         <t:form t:id="editForm">
>             
>             <t:zone t:id="updateZone">
>                 <t:select t:id="theOtherValue" t:model="otherValues" t:value="other" blankOption="never" />
>             </t:zone>
>             
>             <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="prop:updateZoneId" />
>             
>         </t:form>
>     </t:block>

Then I stored the generated client id of the zone in a persistent field and altered the event handler like this:

>     @Persist
>     private String updateZoneId;
> 
>     @OnEvent(component = "thisValue", value = EventConstants.VALUE_CHANGED)
>     void onValueSelected() {
> 
>         selectedBlock = editBlock;
> 
>         clickCount++;
>         ajaxResponseRenderer.addRender(this.updateZoneId, updateZone);
>     }
> 
>     public String getUpdateZoneId() {
> 
>         this.updateZoneId = updateZone.getClientId();
>         return this.updateZoneId;
>     }

The order is now critical. If you put the select in front of the zone it won't work since the beginRender phase of the zone is called after the select's zone attribute is set ( t:zone="prop:updateZoneId" ). 
It's the only way it works and I think it's a bug that it does so.




Am 06.11.2011 um 18:04 schrieb Lenny Primak:

> Are you doing form submit via JavaScript onsubmit()?  If yes, you need to call setSubmittingElement beforehand. 
> 
> 
> 
> On Nov 6, 2011, at 11:11 AM, Christian Riedel <cr...@googlemail.com> wrote:
> 
>> Hi,
>> 
>> I'm currently trying to fix some missing functionality about some cases of zone-updates in tapestry5-jquery. It seems the missing feature does also not work in a pure T5-app!
>> 
>> The feature I'm talking about is this: 
>> 1. There's a link/button/whatever that can trigger a zone-update.
>> 2. Before any update of the zone is done, a default block is rendered using the delegate component.
>> 3. The zone-update is triggered and the zone's delegate component will render a block with some form-components.
>> 4. The form contains a zone and a select box that may trigger another zone-update - this time it's meant to update the zone inside the form.
>> 
>> The moment you trigger the "show-me-the-form" zone-update you'll receive an alert message saying: 
>>> "Could not find zone element 'updateZone' to update on change of element 'thisValue_1337998b0f1'."
>> 
>> ...sure because the 'updateZone' has a generated id, just like the select box. The id is in this case 'updateZone_1337998b0f1'.
>> 
>> I thought there's some magic in tapestry.js (the ZoneManager sounded so promising) that looks for a relative zone with the same id-postfix... but there is no such feature :-(
>> What do you think? Shouldn't be there such a feature? I mean, if I take the same form with the same nested zone just without the whole outer zone and block construct it just works, since there are no generated ids.
>> 
>> Here's what I thought should work (hope there's no copy-paste-error):
>> 
>> __________________________________________________________________
>> 
>> Index.tml (I used the archetype default app to test this):
>> __________________________________________________________________
>> 
>> <!DOCTYPE html>
>> <html t:type="layout" title="taptest Index"
>>     t:sidebarTitle="Framework Version"
>>     xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
>>     xmlns:p="tapestry:parameter">
>>       <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml -->
>> 
>>   <p>${message:greeting}</p>
>> 
>>   <p>The current time is: <strong>${currentTime}</strong></p>
>> 
>>   <!-- A Zone is a component that can be updated in place, triggered by other components. -->
>>   <t:zone t:id="zone">
>>       <p>
>>           You have clicked the link <strong>${clickCount}</strong> times.
>>       </p>
>> 
>>       <p>
>>           [
>>           <t:actionlink t:id="increment">increment</t:actionlink>
>>           ]
>>           &nbsp;
>>           [
>>           <t:actionlink t:id="incrementAjax" zone="^">increment (via Ajax)</t:actionlink>
>>           ]
>>       </p>
>> 
>>   </t:zone>
>> 
>>   <t:zone t:id="outerZone">
>>       <t:delegate t:to="block" />
>>   </t:zone>
>> 
>>   <p:sidebar>
>>       <p>
>>           You are running Tapestry version <strong>${tapestryVersion}</strong>.
>>       </p>
>> 
>> 
>>       <p>
>>           [
>>           <t:pagelink page="Index">refresh page</t:pagelink>
>>           ]
>>       </p>
>>   </p:sidebar>
>> 
>>   <t:block t:id="emptyBlock">
>>       <p>empty</p>
>>   </t:block>
>> 
>>   <t:block t:id="editBlock">
>>       <t:form t:id="editForm">
>> 
>>           <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="updateZone" />
>> 
>>           <t:zone t:id="updateZone">
>>               <t:select t:id="theOtherValue" t:model="otherValues" t:value="other" blankOption="never" />
>>           </t:zone>
>> 
>>       </t:form>
>>   </t:block>
>> 
>> </html>
>> 
>> __________________________________________________________________
>> 
>> Index.class
>> __________________________________________________________________
>> 
>> 
>> /**
>> * Start page of application taptest.
>> */
>> public class Index
>> {
>>   @InjectComponent
>>   private Zone zone, updateZone, outerZone;
>> 
>>   @Inject
>>   private Block emptyBlock, editBlock;
>> 
>>   private Block selectedBlock;
>> 
>>   @Persist
>>   @Property
>>   private int clickCount;
>> 
>>   @Inject
>>   private AlertManager alertManager;
>> 
>>   @Inject
>>   private AjaxResponseRenderer ajaxResponseRenderer;
>> 
>>   @Property
>>   private List<String> selected;
>> 
>>   public ValueEncoder<String> getEncoder() {
>> 
>>       return new ValueEncoder<String>() {
>> 
>>           @Override
>>           public String toValue(String clientValue) {
>> 
>>               return clientValue;
>>           }
>> 
>>           @Override
>>           public String toClient(String value) {
>> 
>>               return value;
>>           }
>>       };
>>   }
>> 
>>   public List<String> getValues() {
>> 
>>       return Arrays.asList(new String[] {
>> 
>>               "asdf",
>>               "qwer",
>>               "dedede",
>>               "kkkkkkk"
>>       });
>>   }
>> 
>>   @Property
>>   private String other;
>> 
>>   public List<String> getOtherValues() {
>> 
>>       return Arrays.asList(new String[] {
>> 
>>               "Count: " + clickCount
>>       });
>>   }
>> 
>>   @OnEvent(component = "thisValue", value = EventConstants.SELECTED)
>>   void onValueSelected() {
>> 
>>       selectedBlock = editBlock;
>> 
>>       clickCount++;
>>       ajaxResponseRenderer.addRender(updateZone);
>>   }
>> 
>>   @SetupRender
>>   void setup() {
>> 
>>       selectedBlock = emptyBlock;
>> 
>>       selected = new ArrayList<String>();
>>       selected.add("asdf");
>>   }
>> 
>>   public Date getCurrentTime()
>>   {
>>       return new Date();
>>   }
>> 
>>   void onActionFromIncrement()
>>   {
>> 
>>       selectedBlock = editBlock;
>> 
>>       alertManager.info("Increment clicked");
>> 
>>       clickCount++;
>>   }
>> 
>>   void onActionFromIncrementAjax()
>>   {
>> 
>>       selectedBlock = editBlock;
>> 
>>       clickCount++;
>> 
>>       alertManager.info("Increment (via Ajax) clicked");
>> 
>>       ajaxResponseRenderer.addRender("outerZone", this.outerZone)
>>                           .addRender("zone", zone);
>>   }
>> 
>>   public Block getBlock() {
>> 
>>       return selectedBlock;
>>   }
>> }
>> 
>> 
>> 
>> __________________________________________________________________
>> 
>> Workaround:
>> __________________________________________________________________
>> 
>> Luckily, there's a workaround:
>> If the select's zone attribute looks like this...
>> 
>>> <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="prop:updateZoneId" />
>> 
>> ... and the page code like this ...
>>>   public String getUpdateZoneId() {
>>> 
>>>       return updateZone.getClientId();
>>>   }
>> 
>> 
>> ... then everything works as expected.
>> 
>> But I find this workaround quite ugly. Should I open up a JIRA? Howard, Igor, Thiago and the others - what do you think?
>> 
>> 
>> Regards
>> 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: [T5.3-rc-3] zone inside a form with generated ids not working

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Are you doing form submit via JavaScript onsubmit()?  If yes, you need to call setSubmittingElement beforehand. 



On Nov 6, 2011, at 11:11 AM, Christian Riedel <cr...@googlemail.com> wrote:

> Hi,
> 
> I'm currently trying to fix some missing functionality about some cases of zone-updates in tapestry5-jquery. It seems the missing feature does also not work in a pure T5-app!
> 
> The feature I'm talking about is this: 
> 1. There's a link/button/whatever that can trigger a zone-update.
> 2. Before any update of the zone is done, a default block is rendered using the delegate component.
> 3. The zone-update is triggered and the zone's delegate component will render a block with some form-components.
> 4. The form contains a zone and a select box that may trigger another zone-update - this time it's meant to update the zone inside the form.
> 
> The moment you trigger the "show-me-the-form" zone-update you'll receive an alert message saying: 
>> "Could not find zone element 'updateZone' to update on change of element 'thisValue_1337998b0f1'."
> 
> ...sure because the 'updateZone' has a generated id, just like the select box. The id is in this case 'updateZone_1337998b0f1'.
> 
> I thought there's some magic in tapestry.js (the ZoneManager sounded so promising) that looks for a relative zone with the same id-postfix... but there is no such feature :-(
> What do you think? Shouldn't be there such a feature? I mean, if I take the same form with the same nested zone just without the whole outer zone and block construct it just works, since there are no generated ids.
> 
> Here's what I thought should work (hope there's no copy-paste-error):
> 
> __________________________________________________________________
> 
> Index.tml (I used the archetype default app to test this):
> __________________________________________________________________
> 
> <!DOCTYPE html>
> <html t:type="layout" title="taptest Index"
>      t:sidebarTitle="Framework Version"
>      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
>      xmlns:p="tapestry:parameter">
>        <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml -->
> 
>    <p>${message:greeting}</p>
> 
>    <p>The current time is: <strong>${currentTime}</strong></p>
> 
>    <!-- A Zone is a component that can be updated in place, triggered by other components. -->
>    <t:zone t:id="zone">
>        <p>
>            You have clicked the link <strong>${clickCount}</strong> times.
>        </p>
> 
>        <p>
>            [
>            <t:actionlink t:id="increment">increment</t:actionlink>
>            ]
>            &nbsp;
>            [
>            <t:actionlink t:id="incrementAjax" zone="^">increment (via Ajax)</t:actionlink>
>            ]
>        </p>
> 
>    </t:zone>
> 
>    <t:zone t:id="outerZone">
>        <t:delegate t:to="block" />
>    </t:zone>
> 
>    <p:sidebar>
>        <p>
>            You are running Tapestry version <strong>${tapestryVersion}</strong>.
>        </p>
> 
> 
>        <p>
>            [
>            <t:pagelink page="Index">refresh page</t:pagelink>
>            ]
>        </p>
>    </p:sidebar>
> 
>    <t:block t:id="emptyBlock">
>        <p>empty</p>
>    </t:block>
> 
>    <t:block t:id="editBlock">
>        <t:form t:id="editForm">
> 
>            <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="updateZone" />
> 
>            <t:zone t:id="updateZone">
>                <t:select t:id="theOtherValue" t:model="otherValues" t:value="other" blankOption="never" />
>            </t:zone>
> 
>        </t:form>
>    </t:block>
> 
> </html>
> 
> __________________________________________________________________
> 
> Index.class
> __________________________________________________________________
> 
> 
> /**
> * Start page of application taptest.
> */
> public class Index
> {
>    @InjectComponent
>    private Zone zone, updateZone, outerZone;
> 
>    @Inject
>    private Block emptyBlock, editBlock;
> 
>    private Block selectedBlock;
> 
>    @Persist
>    @Property
>    private int clickCount;
> 
>    @Inject
>    private AlertManager alertManager;
> 
>    @Inject
>    private AjaxResponseRenderer ajaxResponseRenderer;
> 
>    @Property
>    private List<String> selected;
> 
>    public ValueEncoder<String> getEncoder() {
> 
>        return new ValueEncoder<String>() {
> 
>            @Override
>            public String toValue(String clientValue) {
> 
>                return clientValue;
>            }
> 
>            @Override
>            public String toClient(String value) {
> 
>                return value;
>            }
>        };
>    }
> 
>    public List<String> getValues() {
> 
>        return Arrays.asList(new String[] {
> 
>                "asdf",
>                "qwer",
>                "dedede",
>                "kkkkkkk"
>        });
>    }
> 
>    @Property
>    private String other;
> 
>    public List<String> getOtherValues() {
> 
>        return Arrays.asList(new String[] {
> 
>                "Count: " + clickCount
>        });
>    }
> 
>    @OnEvent(component = "thisValue", value = EventConstants.SELECTED)
>    void onValueSelected() {
> 
>        selectedBlock = editBlock;
> 
>        clickCount++;
>        ajaxResponseRenderer.addRender(updateZone);
>    }
> 
>    @SetupRender
>    void setup() {
> 
>        selectedBlock = emptyBlock;
> 
>        selected = new ArrayList<String>();
>        selected.add("asdf");
>    }
> 
>    public Date getCurrentTime()
>    {
>        return new Date();
>    }
> 
>    void onActionFromIncrement()
>    {
> 
>        selectedBlock = editBlock;
> 
>        alertManager.info("Increment clicked");
> 
>        clickCount++;
>    }
> 
>    void onActionFromIncrementAjax()
>    {
> 
>        selectedBlock = editBlock;
> 
>        clickCount++;
> 
>        alertManager.info("Increment (via Ajax) clicked");
> 
>        ajaxResponseRenderer.addRender("outerZone", this.outerZone)
>                            .addRender("zone", zone);
>    }
> 
>    public Block getBlock() {
> 
>        return selectedBlock;
>    }
> }
> 
> 
> 
> __________________________________________________________________
> 
> Workaround:
> __________________________________________________________________
> 
> Luckily, there's a workaround:
> If the select's zone attribute looks like this...
> 
>> <t:select t:id="thisValue" t:model="values" t:value="selected" t:zone="prop:updateZoneId" />
> 
> ... and the page code like this ...
>>    public String getUpdateZoneId() {
>> 
>>        return updateZone.getClientId();
>>    }
> 
> 
> ... then everything works as expected.
> 
> But I find this workaround quite ugly. Should I open up a JIRA? Howard, Igor, Thiago and the others - what do you think?
> 
> 
> Regards
> 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