【问题标题】:Jenkins/Hudson Dynamic content displayJenkins/Hudson 动态内容展示
【发布时间】:2023-03-15 02:41:01
【问题描述】:

我需要在 builder/buildwrapper 的文本框中输入一些文本,这将与 db 交互并获取一些数据。在构建作业之前,我需要在 UI 中显示这些数据。我可以在构建的返回数据中检查这些值。

我面临的问题:

<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)};

    }

当我尝试调用描述符方法来获取它不接受 x.value 的值时,如果我传递字符串,它会接受并返回数据。

其次,当我尝试使用 javascript 更新选择器列表时,它在果冻中不起作用。

能否请您提供插件,我可以在其中参考类似类型的任务或帮助我解决此问题。

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

【问题讨论】:

    标签: javascript jenkins hudson jenkins-plugins hudson-plugins


    【解决方案1】:

    经过长时间的搜索,我能够解决问题,这里 Jenkins plugin 进行调查。

    Hudson Plugin

    不需要javascript。 doFillNumberitems(@Queryparameter textdata) 解决了这个问题以及下面的布局。

    <?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>
    

    【讨论】:

      猜你喜欢
      • 2012-01-12
      • 2011-06-10
      • 2014-03-26
      • 2012-08-24
      • 2020-05-25
      • 2011-09-17
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      相关资源
      最近更新 更多