need help on drop down option

595 views
Skip to first unread message

Irfan Sayed

unread,
May 8, 2013, 2:33:30 AM5/8/13
to jenkin...@googlegroups.com
hi,

i have created plugin which consolidates the perforce sync option at run-time using drop down box.
when user clicks on any option in drop down box, respective operation started 

following are the options in drop down box:
1: Normal sync 
2: disable sync 
3: force sync 

now, my requirement is , the moment user selects the "force sync" option in drop down box , textbox should be displayed. and if, user selects some other option then textbox should be invisible.

i have used "dropdownListBlock" and "dropdownList" tags but the results are not the expected one 

following is the index.jelly file 

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">

    <f:entry title="${%Perforce Sync Option}">
     <div name="parameter">
            <input type="hidden" name="name" value="${it.name}" />
            <select name="syncOption">
                <j:forEach var="option" items="${it.syncOptions}">
                    <f:option>${option}</f:option>
                </j:forEach>
            </select>
        </div>
    <table>
       <j:set var="currentOption" value="${it.syncOption}"/>
         <f:dropdownList name="fruit" title="Fruits">
           <j:forEach var="option" items="${it.syncOptions}" varStatus="loop">
           <f:dropdownListBlock title="${descriptor.displayName}" value="${loop.index}"
                selected="false" staplerClass="${descriptor.clazz.name}">
          
          </f:dropdownListBlock>
          </j:forEach>
        </f:dropdownList>
        </table>
        </f:entry>
</j:jelly>


can you please review and let me know what needs to be done 

please suggest

regards
irfan

Irfan Sayed

unread,
May 8, 2013, 4:58:26 AM5/8/13
to jenkin...@googlegroups.com
further, i modified the index.jelly as following:

<?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">
  
       <j:set var="currentOption" value="${it.syncOptions}"/>
       <f:dropdownList name="sync" title="Perforce Sync Options">
        <div name="parameter">
          
           <j:forEach var="descriptor" items="${it.SyncDescriptor}" varStatus="loop">
          <j:forEach var="option" items="${it.syncOptions}" varStatus="loop">
            
            <j:set var="option" value="${descriptor==currentOption.descriptor?currentOption:null}"/>
            <f:dropdownListBlock title="${descriptor.displayName}" value="${loop.index}"
                                 selected="${option!=null}" staplerClass="${descriptor.clazz.name}">
              
            </f:dropdownListBlock>
          </j:forEach>
          </div>
        </f:dropdownList>
     
</j:jelly>

still results are not getting as expected 
please suggest

regards


Mads Nielsen

unread,
May 8, 2013, 7:24:49 AM5/8/13
to jenkin...@googlegroups.com
Have you tried using this one: 



--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

Mads Nielsen
Consultant
Praqma A/S

Tel: +45 50 98 18 09
Mail: m...@praqma.net
web: www.praqma.net

Irfan Sayed

unread,
May 8, 2013, 7:33:05 AM5/8/13
to jenkin...@googlegroups.com
No. i haven't tried.

i have referred https://github.com/jenkinsci/jenkins/tree/master/ui-samples-plugin
this plugin has example of dropdown list.
i have never found dropdownDescriptorSelector being used in above plugin for dropdown , so , i am not aware of how to use it 

can you please give me some example ?
i can refer that 

regards



Irfan Sayed

unread,
May 8, 2013, 10:17:54 AM5/8/13
to jenkin...@googlegroups.com
Please suggest.
I am really stuck... Please

Regards

司芳源

unread,
Dec 4, 2017, 12:20:01 AM12/4/17
to Jenkins Developers
It seems to me that dropdowndescriptorselector is a wrapper for the dropdown list in the ui-samples-plugin
Reply all
Reply to author
Forward
0 new messages