Hi Robert,

Thanks for the reply...No dice on this one. I double checked the values and
made two helper methods on my JobProperty:


  public boolean isTagFileEmpty() {
    return StringUtils.isBlank(tagFile);
  }

  public boolean isTaggingEmpty() {
    return StringUtils.isBlank(tagging);
  }

Didn't work...i still get the radioBlock rendering the second option even
though it's not checked and added a couple of debug prints to the top:


My jelly template was modified as well:

<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:optionalBlock name="on" checked="${instance.on}" title="DataDog
tagging" inline="true">
        <h3>Tag is empty: ${instance.isTaggingEmpty()}
${instance.tagging}</h3>
        <h3>File is empty: ${instance.isTagFileEmpty()}
${instance.tagFile}</h3>
        <f:radioBlock title="Properties content" name="choice"
checked="${!instance.isTaggingEmpty()}">
            <f:entry title="Properties" field="tagging">
                <f:textarea/>
            </f:entry>
        </f:radioBlock>
        <f:radioBlock title="File from workspace" name="choice"
checked="${!instance.isTagFileEmpty()}">
            <f:entry title="File" field="tagFile">
                <f:textbox/>
            </f:entry>
        </f:radioBlock>
    </f:optionalBlock>
</j:jelly>
​
This is seriously annoying :P

One thing that happens...if i remove the OptionalBlock wrapping my radio
blocks, it renders correctly on reload (I.e it doesn't render the elements
nested under the second radio block), but i get 2 checkboxes on my jobs
configure page instead of the one i want. I used EnvInject as inspiration
for the template.


Any other suggestions. I think i might abandon this entirely and create
descriptors/describables for my two options...just seems overly complicated
for such a simple control...:/


Best regards
Mads
[image: ____________________________________________________________]
Mads Nielsen
Consultant
[email protected]
+45 50 98 18 09 <+45%2050%2098%2018%2009>
Skype: inkspot
Praqma
www.praqma.com
DK: CPH, Aarhus, Allerod
NO: OSL
SE: STHLM
+45 36 PRAQMA <+4536772762>
<http://www.josra.org/blog/An-automated-git-branching-strategy.html?src=mailbanner>

On Tue, Mar 8, 2016 at 12:04 PM, Robert Sandell <[email protected]>
wrote:

> My guess is that instance.tagFile is no longer null because the previous
> form posting set the value to an empty string.
>
> try checked="${not empty instance.tagFile}" or maybe it's the other way
> around (${instance.tagFile not empty}), those jexl expressions confuse me
> sometimes ;)
>
> /B
>
> On Tue, Mar 8, 2016 at 11:31 AM, Mads Nielsen <[email protected]> wrote:
>
>> Hi Guyes,
>>
>> I have a problem. What im trying to do is to have Jenkins render a
>> radio-button group with mutually exclusive options in a Job property. This
>> work fine when the job is getting configured.
>>
>> But when i reload the page...i get this:
>>
>>
>> ​Even though i have not selected the File from workspace option, it still
>> renders the block under the radio button on page load.
>>
>> Here is my jelly code, what am i doing wrong? I checked that my
>> expressions that evaluate the checked state are correct.
>>
>> <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:optionalBlock name="on" checked="${instance.on}" title="DataDog
>> tagging" inline="true">
>>         <f:radioBlock title="Properties content" name="choice"
>> checked="${instance.tagging != null}">
>>             <f:entry title="Properties" field="tagging">
>>                 <f:textarea/>
>>             </f:entry>
>>         </f:radioBlock>
>>         <f:radioBlock title="File from workspace" name="choice"
>> checked="${instance.tagFile != null}">
>>             <f:entry title="File" field="tagFile">
>>                 <f:textbox/>
>>             </f:entry>
>>         </f:radioBlock>
>>     </f:optionalBlock>
>> </j:jelly>
>>
>>
>> Best regards,
>> Mads
>> [image: ____________________________________________________________]
>> Mads Nielsen
>> Consultant
>> [email protected]
>> +45 50 98 18 09 <+45%2050%2098%2018%2009>
>> Skype: inkspot
>> Praqma
>> www.praqma.com
>> DK: CPH, Aarhus, Allerod
>> NO: OSL
>> SE: STHLM
>> +45 36 PRAQMA <+4536772762>
>>
>> <http://www.josra.org/blog/An-automated-git-branching-strategy.html?src=mailbanner>
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-dev/CAFariusD05U9jxMLfHD%2BK7xaP40THCFTBOJSwq0H3MowXYE3nA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-dev/CAFariusD05U9jxMLfHD%2BK7xaP40THCFTBOJSwq0H3MowXYE3nA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Robert Sandell
> *Software Engineer*
> *CloudBees Inc.*
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS1T34ZTq_b3GZGpPVs%3Dt6B6%3D%2BZFwX4P6267DJ27WhqaMw%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS1T34ZTq_b3GZGpPVs%3Dt6B6%3D%2BZFwX4P6267DJ27WhqaMw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAFariuu5NYq21Zxs2NT4rww%3DLczTB%2BMAEdqDCu6541uVG18dqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to