Help with radioboxes in jelly script needed

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with radioboxes in jelly script needed

Thomas Fuerer
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks!

I'm working currently on an extension for the SCTMExecutor plugin. I
would use the build number to execute tests on SCTM (but this is not the
problem) :-)

I have designed the following jelly script for some options in the workflow:
<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:advanced>
    <j:set var="option" value="${instance.buildNumberUsageOption}"/>
    <f:entry title="${option}"/>
    <f:radioBlock name="buildNumberUsageOption" value="1" title="Don't
care about a build number" checked="${option==1}"></f:radioBlock>
    <f:radioBlock name="buildNumberUsageOption" value="2" title="Use
build number from this job" checked="${option==2}"></f:radioBlock>
    <f:radioBlock name="buildNumberUsageOption" value="3" title="Use
build number from upstream job" checked="${option==3}">
      <f:entry title="Name of upstream job">
        <f:textbox field="upStreamJobName"
value="${instance.upStreamJobName}"></f:textbox>
      </f:entry>
    </f:radioBlock>
  </f:advanced>
</j:jelly>

The rendering is okay but the persistence of the choice failed.
1.) I'm not sure if I understand the radioblock tag correct. Whats
happen if I select a radio box in the ui. Is the variable specified with
name set with the specified value? Because no value is stored and during
debugging I get also no value for this variable.
2.) How is the check made if one of the radios are selected before and
stored. I found the checked attribute, but as I have no value in option
this works not correctly.
3.) I would use for the 3rd option instead of the textfield a listbox.
but I don't know how I get the the value in this ui-component, and how a
select the value of choice.

Thanks for your help, I 'm sure this is some easy problem for you.

thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkny8aoACgkQvPlwZgLDckLgpQCgnJuOgZS9qbvdWgcpzv0T5VuK
2JkAoJZmqNte4we6AjSftE1sblDuu19F
=InR9
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Help with radioboxes in jelly script needed

Ulli Hafner-2
Hmm, I'm rather using the f:radio tag iun my plug-in:

  <f:entry title="${%Priority evaluation}"
description="${%description.limit}">
    <f:radio name="${id}.thresholdLimit" value="high"
checked="${instance.thresholdLimit == 'high'}"
id="thresholdLimit.high"/>
    <st:nbsp/>
    <label for="thresholdLimit.high">${%Only priority high}</label>
    <st:nbsp />
    <f:radio name="${id}.thresholdLimit" value="normal"
checked="${instance.thresholdLimit == 'normal'}"
id="thresholdLimit.normal"/>
    <st:nbsp/>
    <label for="thresholdLimit.normal">${%Priorities high and
normal}</label>
    <st:nbsp />
    <j:if test="${instance != null}">
      <f:radio name="${id}.thresholdLimit" value="low" title=""
checked="${instance.thresholdLimit == 'low'}" id="thresholdLimit.low"/>
    </j:if>
    <j:if test="${instance == null}">
      <f:radio name="${id}.thresholdLimit" value="low" title=""
checked="${true}" id="thresholdLimit.low"/>
    </j:if>
    <st:nbsp/>
    <label for="thresholdLimit.low">${%All priorities}</label>
    <st:nbsp />
  </f:entry>

That works in my case...

Ulli

> -----Original Message-----
>
> I'm working currently on an extension for the SCTMExecutor
> plugin. I would use the build number to execute tests on SCTM
> (but this is not the
> problem) :-)
>
> I have designed the following jelly script for some options
> in the workflow:
> <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:advanced>
>     <j:set var="option" value="${instance.buildNumberUsageOption}"/>
>     <f:entry title="${option}"/>
>     <f:radioBlock name="buildNumberUsageOption" value="1"
> title="Don't care about a build number"
> checked="${option==1}"></f:radioBlock>
>     <f:radioBlock name="buildNumberUsageOption" value="2"
> title="Use build number from this job"
> checked="${option==2}"></f:radioBlock>
>     <f:radioBlock name="buildNumberUsageOption" value="3"
> title="Use build number from upstream job" checked="${option==3}">
>       <f:entry title="Name of upstream job">
>         <f:textbox field="upStreamJobName"
> value="${instance.upStreamJobName}"></f:textbox>
>       </f:entry>
>     </f:radioBlock>
>   </f:advanced>
> </j:jelly>
>
> The rendering is okay but the persistence of the choice failed.
> 1.) I'm not sure if I understand the radioblock tag correct.
> Whats happen if I select a radio box in the ui. Is the
> variable specified with name set with the specified value?
> Because no value is stored and during debugging I get also no
> value for this variable.
> 2.) How is the check made if one of the radios are selected
> before and stored. I found the checked attribute, but as I
> have no value in option this works not correctly.
> 3.) I would use for the 3rd option instead of the textfield a listbox.
> but I don't know how I get the the value in this
> ui-component, and how a select the value of choice.
>
> Thanks for your help, I 'm sure this is some easy problem for you.
>
> thomas
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkny8aoACgkQvPlwZgLDckLgpQCgnJuOgZS9qbvdWgcpzv0T5VuK
> 2JkAoJZmqNte4we6AjSftE1sblDuu19F
> =InR9
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]