Skip to main content
Jump to: navigation, search

Jelly form controls

Jelly form controls

Building Tag Library Documentation

Most of the the jelly files in the Hudson source have embedded documentation .

Validation Button

This tag creates a right-aligned button for performing server-side validation. It is suitable for situations where the validation depends on the values of multiple input fields, such as credential check that uses both username and password. Jelly code

<f:entry title="${%Access Key ID}" help="...">
  <f:textbox field="accessId" />
<f:entry title="${%Secret Access Key}" help="...">
  <f:password field="secretKey" />
   title="${%Test Connection}" progress="${%Testing...}"
   method="testConnection" with="secretKey,accessId" />


The title attribute is used to determine the text written on the button. The progress attribute determines the message displayed while the server-side validation is in progress. The method attribute specifies the server-side method invoked by this button; this follows the stapler name mangling convention, so for example method="testConnection" will invoke the doTestConnection method. This method needs to be on the Descriptor class that owns this form fragment.

Finally, the with attribute specifies the input fields sent to the server for the validation. They are matched against the field attribute or the name attribute of other input controls. The values of the nearest input fields above the <f:validateButton/> are sent to the server, so this means the button has to come after the input fields. Multiple fields can be specified by using ','.

On the server side, this tag invokes the standard "check"-style method like this:

public void doTestConnection(StaplerRequest req, StaplerResponse rsp,
    @QueryParameter("accessId") final String accessId, @QueryParameter("secretKey") final String secretKey) throws IOException, ServletException {
    new FormFieldValidator(req,rsp,true) {
        protected void check() throws IOException, ServletException {
            try {
                ... do some tests ...
            } catch (EC2Exception e) {
                error("Client error : "+e.getMessage());

The check method contains the validation logic. In the end, this method has to call either ok, warning, or error method. Depending on which method you use, the appropriate HTML will be rendered on the client side to indicate the status to the user.


Expandable section that shows "advanced..." button by default. Upon clicking it, a section unfolds.

Optional attributes:

help (optional) If present, URL of the help HTML page.

Jelly code

<f:section title="Advanced Project Options">
    <p:config-quietPeriod />
    <st:include page="configure-advanced.jelly" optional="true" />

Example: At start only button is shown:

Advanced not clicked.PNG

When the button is clicked it disappears, and the content is displayed instead:

Advanced clicked.PNG


Foldable block expanded when the menu item is checked.

Mandatory attributes:

name Name of the checkbox. title Human readable text that follows the checkbox checked Initial checkbox status. true/false.

Optional attributes:

help (optional) If present, URL of the help HTML page.

Jelly code Example

    <f:optionalBlock name="dynamic" title="Use existing dynamic view">
      <f:entry title="View drive">
        <f:textbox name="drive" value="${}"/>

Unchecked the text box will not be displayed:

Optional block unchecked.PNG

Checked the text box is displayed

Optional block checked.PNG

Select (drop-down menu)

Use an <f:entry> tag to enclose the normal select tag. Jelly code Example

<f:entry name="goalType" title="Choose Goal Type" field="goalType">
  <select name="goalType">
    <option value="buildGoal">Build Goal</option>
    <option value="findBugsGoal">FindBugs goal</option>


Back to the top