Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2331

Can't stop tapestry generating clientId for fields

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.4
    • None

    Description

      I want to be able to specify a clientId so that tapestry doesn't auto-generate one for me. This works on many core tapestry components when I specify an "id" because the following code is present:

      clientId = resources.isBound("id") ? idParameter : renderSupport.allocateClientId(resources);
      

      But in AbstractField, this logic is different

      @Parameter(value = "prop:componentResources.id", defaultPrefix = BindingConstants.LITERAL)
      private String clientId;
      
      final void setup() {
         String id = clientId;
         ...
         assignedClientId = jsSupport.allocateClientId(id);
      }
      
      public final String getClientId() {
         return assignedClientId;
      }
      

      This means that tapestry will generate id's like "foo_af42a49d19a" after zone updates when I set clientId to "foo". This makes it impossible to attach clientside behaviour by field id selectors.

      As a workaround, I add "data-" attributes to my fields and select by them instead. I assume this has worse performance than id based selectors.

      Forum thread here

      Attachments

        Activity

          People

            thiagohp Thiago Henrique De Paula Figueiredo
            uklance Lance S
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: