Search code examples
javascriptjenkinshudsonjenkins-pluginshudson-plugins

Jenkins/Hudson Dynamic content display


I have requirement like to enter some text in text box in builder/buildwrapper which will interact with db & fetch some data. This data i need to display in UI before building the job.I can check those some values among return data for the build.

Issues i am facing:

<script type="text/javascript">
    function myFunction() {
        var x = document.getElementById("name");
        x.value = x.value.toUpperCase();
        var y =document.getElementById("dataselect");   
        var z=${descriptor.getMyString(x.value)};

    }

when i am trying call a descriptor method to get the value it doesnot accept x.value where if i pass string it accepts & returns the data.

Secondly when i am trying to update the selector list using javascript it doesn't work in jelly.

Can you please provide me the plugin where i can refer for similar type of task or help me to resolve this issue.

 <f:entry title="Dataselect" field="dataselect">
   <f:select multiple="multiple" id="dataselect"/>
 </f:entry>

Solution

  • After long search I able to resolve the issue, Here the Jenkins plugin to look into.

    or Hudson Plugin

    The javascript not required. doFillNumberitems(@Queryparameter textdata) resolved the issue along with below layout.

    <?jelly escape-by-default='true'?>
    <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" xmlns:s="/lib/samples">
    
    <script type="text/javascript">
    </script>      
     <f:entry>
      <s:sample>
        <form>
          <table>
            <f:entry title="Enter Text" field="textdata">
              <f:textbox />
            </f:entry>
            <f:entry>
              <j:forEach var="item" items="${instance.textdata}">
                  <label for="${item}" style="color:#9933FF;font-weight: bold">*   ${item}</label><br/>
              </j:forEach>
            </f:entry>
            <f:entry title="Random Number" field="number">
              <f:select multiple="multiple"/>
            </f:entry>
          </table>
        </form>
      </s:sample>
      </f:entry>
    </j:jelly>