Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21731

InvisibleEntry Jelly tag behaves differently from Entry when used inside RepeatableProperty

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core

      I have a Describable called Endpoint, which has the following config.jelly:

      config.jelly
      <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
          <f:invisibleEntry title="Protocol" field="protocol">
              <f:textbox value="UDP" />
          </f:invisibleEntry>
          <f:invisibleEntry title="Format" field="format">
              <f:textbox value="JSON" />
          </f:invisibleEntry>
          <f:entry title="URL" description="IP or hostname of the server" field="url">
              <f:textbox/>
          </f:entry>
          <f:entry title="Port" field="port">
              <f:textbox/>
          </f:entry>
          <f:entry>
              <div align="right">
                  <f:repeatableDeleteButton />
              </div>
          </f:entry>
      </j:jelly>
      

      and a GlobalConfiguration which has a list of Endpoints. The GlobalConfiguration's config.jelly uses repeatableProperty to embed the Endpoint's config.jelly:

      config.jelly
      <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
      
          <f:section>
              <f:entry title="Endpoints" field="endpoints">
                  <f:repeatableProperty field="endpoints"/>
              </f:entry>
          </f:section>
      
      </j:jelly>
      

      The resulting JSON which is sent to GlobalConfiguration.configure(..) looks like this:

      JSON
      {"endpoints":{"endpoints":["UDP","JSON"],"url":"test","port":"3"}}
      

      which obviously isn't correct.

      If I change the two invisibleEntry tags to standard Entry tags, then the JSON is correct:

      JSON
      {"endpoints":{"protocol":"UDP","format":"JSON","url":"test","port":"3"}}
      

          [JENKINS-21731] InvisibleEntry Jelly tag behaves differently from Entry when used inside RepeatableProperty

          Ben Fox-Moore added a comment -

          The HTML generated for the invisibleEntry is this:

          <input class="setting-input " type="text" value="UDP" name="_.endpoints"></input>
          

          If I change it to standard Entry, I get this:

          <input class="setting-input " type="text" value="UDP" name="protocol"></input>
          

          The problem seems to be in how the name field is generated for the input tag.

          Ben Fox-Moore added a comment - The HTML generated for the invisibleEntry is this: <input class= "setting-input " type= "text" value= "UDP" name= "_.endpoints" ></input> If I change it to standard Entry, I get this: <input class= "setting-input " type= "text" value= "UDP" name= "protocol" ></input> The problem seems to be in how the name field is generated for the input tag.

            Unassigned Unassigned
            infernozeus Ben Fox-Moore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: