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

active-choice plugin Reference parameter does not display values in

XMLWordPrintable

      I belive that there is an issue with the:

      https://github.com/jenkinsci/active-choices-plugin/blob/75930aed5229e89282df264a079a81fb52d89ff1/src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js#L225

      script file, which after the tables to div transition is failed to find the DIV elements to populate the values

       

      The generated element seems correct, without any TABLE elements:

       

      <div name="parameter" description="server instance" id="choice-parameter-5762928123724098"><input name="name" type="hidden" value="SERVER_INSTANCE"><div style="float: left; overflow-y: auto; padding-right: 25px; height: 25px;" id="ecp_choice-parameter-5762928123724098"><div id="tbl_ecp_choice-parameter-5762928123724098"><div style="white-space:nowrap" id="tbl_tr_ecp_choice-parameter-5762928123724098" class="tr"><div><input otherid="ecp_choice-parameter-5762928123724098_0" alt="Script error" name="SERVER_INSTANCE" json="Script error" onchange="UnoChoice.fakeSelectRadioButton(&quot;SERVER_INSTANCE&quot;, &quot;ecp_choice-parameter-5762928123724098_0&quot;)" type="radio" value="Script error" class=" "><label class="attach-previous">Script error</label><input name="" json="Script error" id="ecp_choice-parameter-5762928123724098_0" type="hidden" title="Script error" value="Script error" class="SERVER_INSTANCE"></div></div></div></div><script type="text/javascript">(function() {
       var f = function() {
       var height = 0;
       var maxCount = 1;
       if(maxCount > 1) {
       maxCount = 1;
       }
      var refElement = document.getElementById("");
       if(maxCount > 0 && refElement && refElement.offsetHeight !=0) {
       for(var i=0; i< maxCount; i++) {
       height += refElement.offsetHeight + 3;
       }
       }
       else {
       height = maxCount * 25.5;
       }
      height = Math.floor(height);
       document.getElementById("ecp_choice-parameter-5762928123724098").style.height = height + "px";
       };
      f();
       })();</script></div>
      

       

      Also the groovy script seems to return the correct values for the Radio buttons, as enns in the browser's console log:

      Values returned from server: [["element1:selected","element2"],["element1:selected","element2"]]

       

      After more testing I can confirm that replacing TABLE in the if condition with DIV fixes the issues, here is a working copy:

      if (parameterElement.children.length > 0 && parameterElement.children[0].tagName === 'DIV') {

      For backward compatibility "TABLE or DIV" condition maybe would be the best

            kinow Bruno P. Kinoshita
            szjozsef Jozsef
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: