How does a stapler work with select tag

14 views
Skip to first unread message

Nikhil Bhoski

unread,
Jan 23, 2020, 2:26:17 AM1/23/20
to Jenkins Developers
i have below entry in config.jelly for BuildWrapper class 

<f:section>      
    <f:entry title="Version" field="mRoot">
      <select class="setting-input" name="mRoot">
        <j:forEach var="installation" items="${descriptor.installations}">
          <f:option selected="${installation.name==instance.mRoot}" value="${installation.name}">${installation.name} </f:option>
   
       </j:forEach>
      </select>
    
    </f:entry> 
</f:section>


I am trying to validate the dropdown using doCehck method in the same descriptor with below signature

public FormValidation doCheckMRoot(@QueryParameter final String mRoot) {
            if(mRoot==null) {
            return FormValidation.error("No Root selected");
            }else {
            return FormValidation.warning("root is set");
            }
        }


doCheck method does not get executed is there a different way that validation for <select> tag works ? 


Ullrich Hafner

unread,
Jan 23, 2020, 3:07:28 AM1/23/20
to Jenkins Developers
select is a standard HTML tag that is not processed at all. You need to use a <f:select> tag. 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/13f8f0a5-85e2-475c-a053-75b739ae4ea7%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages