I have a text field that I only want to show in the configuration page
if a check box is checked and I wonder how to do it. It should have
the samve functionality as the list of builders/publishers in the job
configuration page have, ie a publisher will only show its config
entries if the check box is checked.
I've found the <optionalBlock> and it seems the job configuration
jeylly pages is using it, but I havent got it right yet. Does anyone
have any idea?
<f:optionalBlock name="clearcase.dynamicview" title="aaa" checked="false">
<f:textbox name="clearcase.viewdrive" value="${scm.viewDrive}" optional="true"/>
</f:optionalBlock>
Regards
//Erik
------
The following code is based on ClearCaseSCM/config.jelly and shows you
how to add foldable section.
You can use <f:nested> instead of <f:block> and they give you different
indentation.
<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">
<f:entry title="Config spec" help="/plugin/clearcase/configspec.html">
<textarea
name="clearcase.configspec"
rows="8"
style="width:100%"
checkUrl="'${rootURL}/scm/ClearCaseSCM/configSpecCheck?value='+escape(this.value)">
${scm.configSpec}
</textarea>
</f:entry>
<f:entry title="View name" help="/plugin/clearcase/localdir.html">
<f:textbox name="clearcase.viewname"
value="${scm.ViewName}"
checkUrl="'${rootURL}/scm/ClearCaseSCM/viewNameCheck?value='+escape(this.value)"/>
</f:entry>
<f:entry title="Use update">
<f:checkbox name="clearcase.useupdate"
checked="${h.defaultToTrue(scm.useUpdate)}"/>
If checked, Hudson will use 'cleartool update' whenever possible, making the
build faster. But this causes the artifacts from the previous build to remain
when a new build starts.
</f:entry>
<f:entry title="Branch" help="/plugin/clearcase/branch.html">
<f:textbox name="clearcase.branch" value="${scm.branch}"/>
</f:entry>
<f:block>
<table>
<f:optionalBlock name="business" title="Book business class flight">
<f:entry title="Airline code">
<f:textbox name="code"
value="${scm.branch}"/>
</f:entry>
</f:optionalBlock>
</table>
</f:block>
</j:jelly>
–
Kohsuke Kawaguchi
See also Jelly form controls