Field validation does not pass required query parameters when some fields are specified in a nested Describable

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      The collabnet plugin was updated/modernized a couple years ago to include code like the following:

      CNDocumentUploader.java DescriptorImpl

      /**
        * Form validation for upload path.
        */
      public FormValidation doCheckUploadPath(CollabNetApp app, @QueryParameter String project, @QueryParameter String value)
      

      CollabNetApp.java

          public static CollabNetApp fromStapler(@QueryParameter boolean overrideAuth, @QueryParameter String url,
                                                 @QueryParameter String username, @QueryParameter String password) 
      

      config.jelly

        <f:property field="connectionFactory" />
      ...
        <f:entry title="Upload Folder Path" field="uploadPath">
          <f:textbox />
        </f:entry>
      

      ConnectionFactory has url, username, and password properties

      The generated field validation javascript then uses the 'nearBy' function when passing query parameters to the checkUploadPath backend in order to find values of url, username, and password. However uploadPath has a parent element with name 'publisher', while the direct parent of url, username, and password is a div has name 'connectionFactory'. 'publisher' is then a grandparent of url, username, and password and because of this, the needed query parameters are not included.

      One might argue that the collabnet plugin should avoid this design, since it does not work, but the changes came from Kohsuke, so attempting find a fix which preserves the current design.

      A patch to the findNearBy function in hudson-behavior.js is attached.

            Assignee:
            John McNally
            Reporter:
            John McNally
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: