Hi Ullrich, Thanks for the advice. But I have looked into that, and as I said, putting all the fields into a dropdownList will wrap them within one JSON object/array. My understanding is that it will involve moving all the frields from the DataBoundConstructor to another Describable object, say TriggerConfig, and leave only one field in my old class, whose name matches the name of the dropdownList. It seems that this refactoring will cause a lot of pain when handling backward compatibility. Do you have any suggestions to that?
Thanks Mathieu Wang On Thursday, December 19, 2013 7:25:45 AM UTC-5, Ullrich Hafner wrote: > > Your approach will not work. The UI examples plug-in shows how to achieve > that. > > Have a look at the templates > - f:dropdownList > - f:dropdownListBlock > > Am 19.12.2013 um 00:50 schrieb Mathieu Wang > <[email protected]<javascript:> > >: > > Hello everyone, > > So I have two f:select dropdowns. The first one is always there, and I > only want to display the second one for certain values in the first > dropdown. > > I had two ideas: > 1. Use a <j:if> tag around the second dropdown as shown below. > However, I am not able to get the current value of the first dropdown. > I've tried putting "@QueryParameter final String serverName" in my > "isEnableMirrorSelectionInJobs" method, but it always returns null. It > seems like @QueryParameter only works for doFill... and doCheck... methods, > and other methods that bind to a form. Passing "serverName" directly to it > (<j:if > test="${descriptor.isEnableMirrorSelectionInJobs(serverName)}">) gives the > same result. > > <f:entry title="${%Choose a server}" > description="${it.description}" field="serverName"> > <f:select/> > </f:entry> > <j:if test="${instance.isEnableMirrorSelectionInJobs()}"> > <f:entry title="${%Choose a mirror}" field="mirror"> > <f:select/> > </f:entry> > </j:if> > > 2. Change the first f:select to f:dropdownList and put everything inside a > f:dropdownListBlock. However, this changes the structure of the entire > JSON object by adding one more level to it, thus needing refactoring on the > DataBoundConstructor, which I don't want. > > Does anyone have an idea how to solve this problem? > Thanks in advance! > > Mathieu Wang > > -- > 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] <javascript:>. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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]. For more options, visit https://groups.google.com/groups/opt_out.
