You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org> on 2005/08/01 02:32:35 UTC

[jira] Created: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
----------------------------------------------------------------------------------------------------------------

         Key: TAPESTRY-517
         URL: http://issues.apache.org/jira/browse/TAPESTRY-517
     Project: Tapestry
        Type: Bug
  Components: Framework  
    Versions: 4.0    
    Reporter: Jonas Maurus
 Attachments: AbstractFormComponent.clientid_fix.diff

Quoting from TAPESTRY-409:

<!-- page definition -->
  <component id="bookkeeperRCB" type="Checkbox">
    <binding name="selected" value="hasBookkeeperRole" />
  </component>
  
  <component id="adminRCB" type="Checkbox">
    <binding name="selected" value="hasAdministratorRole" />
  </component>

<!-- page template -->
<tr>
  <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
  <td><label jwcid="@FieldLabel" for="bookkeeper"
            field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
</tr>
<tr>
  <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
  <td><label jwcid="@FieldLabel" for="admin"
           field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
</tr>

yields:

<tr>
  <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
  <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
</tr>
<tr>
  <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
  <td><label for="adminRCB$0">Administrator</label></td>
</tr>

as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.

I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.

I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.

However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


Re: [jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by Howard Lewis Ship <hl...@gmail.com>.
Didn't mean to jab at you; I'm trying to fix a lot of bugs and pay the
mortgage, so I lose track of some little things.

The static structure of Tapestry makes this coordination pretty difficult.

I think the best thing would be to add a "prerender" parameter to
ListEdit that would default on, and can be turned off in the case that
the FieldLabel occurs after the field.

Yes, it would be nice if they could play well together. 

It's possible that a future, and much different, version of Tapestry
will do two passes over the render tree to handle situations like
this.

On 9/7/05, Jonas Maurus (JIRA) <ta...@jakarta.apache.org> wrote:
>     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12322826 ]
> 
> Jonas Maurus commented on TAPESTRY-517:
> ---------------------------------------
> 
> I honestly don't know why I feel attacked by you, but you didn't say that this is hard to fix, at least not in any official comments you've made.
> 
> Of course, _I know it's hard to fix_, otherwise I'd have a well thought-out patch by now. I _explicitly_ called my code a work-around, because _it is_ bad design. I described 3 additional approaches to fix the problem, none of which I feel would be able to land in time for 4.0 final because they'd  break existing components and change existing contracts or introduce more bad design, but at the component level. Providing the one component where this bug manifests itself right now with a work-around parameter, which was your suggestion, only pushes the bug down the road to be rediscovered by (I'd guess) primarily AJAX components and makes handling FieldLabel's awkward.
> 
> Not fixing this bug would mean to ship Tapestry with components that work only if they're used in a certain order, which is, I'd say, _worse_. Especially since they don't fail "gracefully".
> 
> At the center of the problem is Tapestry's quirky identity concept, which might even be a primary cause for quick page rendering and low memory consumption, so it probably should be kept that way, but it doesn't allow simple loop-handling, I've documented that in my other comments on this bug.
> 
> I believe more and more that my last comment (changing IdAllocator so it can "look into the future") is the way to go. I'm experimenting with different approaches in my spare time. Nevertheless, I seem to remember seeing multiple ways to get Ids in the current Tapestry codebase, so this would have to be unified first, then handling Ids should probably become a HiveMind service. I'm still trying to make loop-handling transparent, so a component doesn't have to know it's in a loop and a "looping component" doesn't have to do any special handling, but this is not easily done. Making it possible to prerender a page's "identity tree" is my current idea that I'm experimenting with.
> 
> I've called for developer input multiple times, in JIRA and on the mailing list and received no reply. If there existed a consensus on how to fix this for 4.0, I'd be more than willing to fix this properly, but I'll be out of the country during the last two weeks of september. I don't mind working on this until then and after coming back and I'd welcome any help. Perhaps you could outline what mechanism you're thinking of, then, at least, there'd be a goal to work toward.
> 
> 
> > Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> > ----------------------------------------------------------------------------------------------------------------
> >
> >          Key: TAPESTRY-517
> >          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
> >      Project: Tapestry
> >         Type: Bug
> >   Components: Framework
> >     Versions: 4.0
> >     Reporter: Jonas Maurus
> >     Assignee: Howard M. Lewis Ship
> >  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff, TAPESTRY-517.clientid_fix.diff
> >
> > Quoting from TAPESTRY-409:
> > <!-- page definition -->
> >   <component id="bookkeeperRCB" type="Checkbox">
> >     <binding name="selected" value="hasBookkeeperRole" />
> >   </component>
> >
> >   <component id="adminRCB" type="Checkbox">
> >     <binding name="selected" value="hasAdministratorRole" />
> >   </component>
> > <!-- page template -->
> > <tr>
> >   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
> >   <td><label jwcid="@FieldLabel" for="bookkeeper"
> >             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> > </tr>
> > <tr>
> >   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
> >   <td><label jwcid="@FieldLabel" for="admin"
> >            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> > </tr>
> > yields:
> > <tr>
> >   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
> >   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> > </tr>
> > <tr>
> >   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
> >   <td><label for="adminRCB$0">Administrator</label></td>
> > </tr>
> > as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> > I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> > I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> > However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.
> 
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


[jira] Updated: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]

Jonas Maurus updated TAPESTRY-517:
----------------------------------

    Attachment: AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff

Patch sent to the Tapestry mailing list for the beta 5 release

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Assigned: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]

Howard M. Lewis Ship reassigned TAPESTRY-517:
---------------------------------------------

    Assign To: Howard M. Lewis Ship

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12317269 ] 

Jonas Maurus commented on TAPESTRY-517:
---------------------------------------

There is obviously something funny going on in FormSupportImpl that gets in the way when a field is prerendered. The above template code (modified for Beta 3, with the attached patch applied):

<tr>
  <td><input jwcid="bookkeeperRCB" type="checkbox" /></td>
  <td><label jwcid="@FieldLabel" for="bookkeeper"
            field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
</tr>
<tr>
  <td><input jwcid="adminRCB" type="checkbox" /></td>
  <td><label jwcid="@FieldLabel" for="admin"
           field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
</tr>

yields:

<input type="hidden" name="formids" value="bookkeeperRCB,bookkeeperRCB$0,adminRCB,adminRCB$0" />
<tr>
  <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB"/></td>
  <td><label for="bookkeeperRCB">Bookkeeper</label></td>
</tr>
<tr>
  <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB"/></td>
  <td><label for="adminRCB">Administrator</label></td>
</tr>

The malformed formids array causes the rewind to fail. I'm posting this so someone can perhaps pick up the work from here, as I have to call it a day now. Please leave a comment if you do, otherwise I'll try to track the bug down tomorrow.

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>  Attachments: AbstractFormComponent.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12320041 ] 

Howard M. Lewis Ship commented on TAPESTRY-517:
-----------------------------------------------

Yep; I applied the patch and saw that behavior for the components inside a loop.

I'm thinking the code should stay the same, but FieldLabel should be changed to provide a parameter to defeat pre-rendering of the component.

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]

Jonas Maurus updated TAPESTRY-517:
----------------------------------

    Attachment: AbstractFormComponent.clientid_fix_4.diff

Updated patch for Tapestry 4.0 Beta 4

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12322770 ] 

Jonas Maurus commented on TAPESTRY-517:
---------------------------------------

I have now looked through all components that implement any kind of loop. They all call renderBody() repeatedly to render their own body multiple times. I also think that a component that loops over its body should not have to manage its childrens identities, the framework should take care of that.

So fixing it the way I did in the last patch might be the way to go after all, but the JavaDoc documentation of renderBody() would have to be changed to reflect that fact, so if someone overwrites renderBody() in his component he'd know what to do.

Another possibility that I didn't get to in my last comment (http://issues.apache.org/jira/browse/TAPESTRY-517#action_12320697) is to change the prerender code in such a way that it doesn't allocate a real ID while rendering the component (not changing IdAllocator's state).

Essentially, the prerender code would operate on a cloned version of IdAllocator, not changing the real IdAllocator's state. During the real rendering cycle, the markup writer would check for prerendered code with the then allocated Id returned by the real IdAllocator and if it was rendered before, just write out the cached HTML. Managing the prerenderMap would move out of FormSupportImpl.

This would also possibly be the first step to make any component prerenderable and therefore Tapestry pages "precompilable" if the markup writer implementation would cache prerendered content on disc.

But that's possibly far in the future and I haven't thought this through, just experimented with a private Tapestry build. For 4.0 I recommend my patch unless I've broken something that I don't know about.

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff, TAPESTRY-517.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]

Jonas Maurus updated TAPESTRY-517:
----------------------------------

    Attachment: AbstractFormComponent.clientid_fix_2.diff

This patch fixes all issues (including the runaway formids), but doesn't fix the underlying design issues. I've started a discussion on the developer mailing list (http://news.gmane.org/gmane.comp.jakarta.tapestry.devel) on this bug to create a roadmap.

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12317266 ] 

Jonas Maurus commented on TAPESTRY-517:
---------------------------------------

(sigh)... this only fixed the first half of the bug. If a FieldLabel for a form component is created after the component has rendered the FieldLabel creates a bogus component id in the "formids"-hidden field, causing the rewind to fail. Still digging...

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>  Attachments: AbstractFormComponent.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12322790 ] 

Howard M. Lewis Ship commented on TAPESTRY-517:
-----------------------------------------------

When I say something is hard, it's because its HARD.

I do not want to introduce these code changes; I don't think they are the right approach (putting special case casts in general purpose code is a bad design smell). 

I'm envisioning, for a future Tapestry, some more powerful mechanism to allow these components to communicate (or to eliminate the need for them to do so).

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff, TAPESTRY-517.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12322826 ] 

Jonas Maurus commented on TAPESTRY-517:
---------------------------------------

I honestly don't know why I feel attacked by you, but you didn't say that this is hard to fix, at least not in any official comments you've made.

Of course, _I know it's hard to fix_, otherwise I'd have a well thought-out patch by now. I _explicitly_ called my code a work-around, because _it is_ bad design. I described 3 additional approaches to fix the problem, none of which I feel would be able to land in time for 4.0 final because they'd  break existing components and change existing contracts or introduce more bad design, but at the component level. Providing the one component where this bug manifests itself right now with a work-around parameter, which was your suggestion, only pushes the bug down the road to be rediscovered by (I'd guess) primarily AJAX components and makes handling FieldLabel's awkward.

Not fixing this bug would mean to ship Tapestry with components that work only if they're used in a certain order, which is, I'd say, _worse_. Especially since they don't fail "gracefully".

At the center of the problem is Tapestry's quirky identity concept, which might even be a primary cause for quick page rendering and low memory consumption, so it probably should be kept that way, but it doesn't allow simple loop-handling, I've documented that in my other comments on this bug.

I believe more and more that my last comment (changing IdAllocator so it can "look into the future") is the way to go. I'm experimenting with different approaches in my spare time. Nevertheless, I seem to remember seeing multiple ways to get Ids in the current Tapestry codebase, so this would have to be unified first, then handling Ids should probably become a HiveMind service. I'm still trying to make loop-handling transparent, so a component doesn't have to know it's in a loop and a "looping component" doesn't have to do any special handling, but this is not easily done. Making it possible to prerender a page's "identity tree" is my current idea that I'm experimenting with.

I've called for developer input multiple times, in JIRA and on the mailing list and received no reply. If there existed a consensus on how to fix this for 4.0, I'd be more than willing to fix this properly, but I'll be out of the country during the last two weeks of september. I don't mind working on this until then and after coming back and I'd welcome any help. Perhaps you could outline what mechanism you're thinking of, then, at least, there'd be a goal to work toward.


> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff, TAPESTRY-517.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]

Jonas Maurus updated TAPESTRY-517:
----------------------------------

    Attachment: AbstractFormComponent.clientid_fix.diff

This patch fixes the clientId caching in AbstractFormComponent (TAPESTRY-517). The size of the required patch suggests to me that it's the right place to fix (following the "if it's simple, it must be right"-principle ;-) ), but it might be the wrong thing to do... I'm fairly new to Tapestry's codebase

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>  Attachments: AbstractFormComponent.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]

Jonas Maurus updated TAPESTRY-517:
----------------------------------

    Attachment: TAPESTRY-517.clientid_fix.diff

new patch, including the work-around from my last comment.

This seems to fix the issue, but will of course not work for components that implement any kind of loop but do not derive from AbstractComponent, or overload renderBody(). Still as it works, I'd guess that it gives directions on how to fix this bug properly. There are 3 possibilities:

1. add a parameter to FieldLabel to skip the prerender so the developer can mark all FieldLabels that are rendered after their associated form fields
2. change all components that rerender (i.e. loop over) other components inside their body so they reset their contained components identity fields on every iteration effectively making them keep their identity while they're being rendered
3. disallow a component instance to change its identity (effectively creating a "one object instance is one component instance" relationship between templates and java code) and rewrite loop handling so that components are instantiated on the fly

I'd say 1 is not intuitive and will only push the bug further down the road, 3 is possibly the right thing to do, but changes Tapestry's performance characteristics, memory usage and potentially breaks stuff.

So I'd go for 2. I guess the following components have to be changed: For, Foreach, ListEdit, Table, FormTable and Tree. I'll try to work on a patch over the next view days, but comments are very welcome at this point as I'm still new to the codebase and might be about to break things that I know nothing about which would make this a worthless exercise :-)

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff, TAPESTRY-517.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12320259 ] 

Jonas Maurus commented on TAPESTRY-517:
---------------------------------------

I don't think that it would be good design if a form component had to use a parameter to distinguish between the cases of being rendered before or after an associated component, because 

a) this bug will only show up more often as more ajax-components are developed that require coupling between multiple form components and 
b) at the core of the problem is Tapestry's identity management that allows one component instance to render itself multiple times representing multiple html entities by changing its identity

However, a work-around that we've currently deployed would be to reset AbstractFormComponent's "identity attributes" each time the component is rendered, while still caching the value returned by IdAllocator as my previous patch does. One way to do this wouldbe modifying AbstractComponent's renderBody() - implementation like so:

    public void renderBody(IMarkupWriter writer, IRequestCycle cycle)
    {
        for (int i = 0; i < _bodyCount; i++) {
            if (_body[i] instanceof AbstractFormComponent) {
                ((AbstractFormComponent)_body[i]).setClientId(null);
                ((AbstractFormComponent)_body[i]).setName(null);
            }
        }
            
        for (int i = 0; i < _bodyCount; i++)
            _body[i].render(writer, cycle);
    }

I'm still digging through Tapestry's codebase (which is huge and I'm fairly new to it), but this works in the Workbench and in our Tapestry 4 application, so it might at least be a work-around. I'll attach a patch containing this modification as soon as beta 5 is out.

Thanks for taking the bug, btw :-)

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=comments#action_12320039 ] 

Howard M. Lewis Ship commented on TAPESTRY-517:
-----------------------------------------------

Taking a look at the most recent patch ... I'm concerned that components inside loops will not render properly.  It seems like they'll get their name stuck.

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Closed: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]
     
Howard M. Lewis Ship closed TAPESTRY-517:
-----------------------------------------

    Fix Version: 4.0
     Resolution: Fixed

Add a prerender parameter which can be set to false when the FieldLabel comes after the field.

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>     Assignee: Howard M. Lewis Ship
>      Fix For: 4.0
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff, AbstractFormComponent.clientid_fix_4.diff, AbstractFormComponent.clientid_fix_cvs_HEAD_20050825_1358.diff, TAPESTRY-517.clientid_fix.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-517) Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong

Posted by "Jonas Maurus (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-517?page=all ]

Jonas Maurus updated TAPESTRY-517:
----------------------------------

    Attachment: AbstractFormComponent.clientid_fix_3.diff

This is the same patch as _2, but I added proper documentation. The first two patches are therefor obsolete.

> Using a FieldLabel component after the decorated form component causes the FieldLabel's id attribute to be wrong
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-517
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-517
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Jonas Maurus
>  Attachments: AbstractFormComponent.clientid_fix.diff, AbstractFormComponent.clientid_fix_2.diff, AbstractFormComponent.clientid_fix_3.diff
>
> Quoting from TAPESTRY-409:
> <!-- page definition -->
>   <component id="bookkeeperRCB" type="Checkbox">
>     <binding name="selected" value="hasBookkeeperRole" />
>   </component>
>   
>   <component id="adminRCB" type="Checkbox">
>     <binding name="selected" value="hasAdministratorRole" />
>   </component>
> <!-- page template -->
> <tr>
>   <td><input jwcid="bookkeeperRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="bookkeeper"
>             field="ognl:components.bookkeeperRCB" displayName="message:form.roles.bookkeeper">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input jwcid="adminRCB" type="checkbox" value="Y" /></td>
>   <td><label jwcid="@FieldLabel" for="admin"
>            field="ognl:components.adminRCB" displayName="message:form.roles.administrator">Administrator</label></td>
> </tr>
> yields:
> <tr>
>   <td><input type="checkbox" name="bookkeeperRCB" id="bookkeeperRCB" value="Y"/></td>
>   <td><label for="bookkeeperRCB$0">Bookkeeper</label></td>
> </tr>
> <tr>
>   <td><input type="checkbox" name="adminRCB" checked="checked" id="adminRCB" value="Y"/></td>
>   <td><label for="adminRCB$0">Administrator</label></td>
> </tr>
> as you can see the generated fieldnames ("bookkeeperRCB$0"...) are wrong. This always results in a stale-link exception.
> I tracked down the bug: FieldLabel calls prerenderField() which in turn causes an uniqueId to be allocated in AbstractFormComponent.renderIdAttribute. Everything works out when the FieldLabel precedes the form component it decorates. If it comes after the form component, IRequestCycle.getUniqueId() will already have stored an id for the component and return a new one.
> I'm not quite sure about the mechanics described above, as I don't fully understand FormSupportImpl yet, perhaps someone else can shed light on this.
> However, the allocated client id wasn't cached properly in AbstractFormComponent.renderIdAttribute. I'll attach a patch as soon as I've saved this bug report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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