Do you mean something like 

return FormValidation.respond(isFieldValid? FormValidation.Kind.ERROR : 
FormValidation.Kind.OK, "<script>disableBadStuff()</script>");

?

I tried this and it doesn't work :( The tag is injected in validation area, 
but the script inside it does not get executed :( And there are no errors 
reported.

Regards,
Kirill.


среда, 4 ноября 2015 г., 21:10:43 UTC пользователь Stephen Connolly написал:
>
> The doCheckArtifact() method returns a FormValidation which gets rendered 
> as a HTML response that gets injected into the page in the validation 
> area...
>
> https://www.youtube.com/watch?v=tNXpnufLVkc
>
> On 4 November 2015 at 20:56, Kirill <[email protected] <javascript:>> 
> wrote:
>
>> Hi Stephen,
>>
>> Thanks for suggestion "*enable and disable* some of the second 
>> descriptors via Javascript from a doCheckArtifact method's response?"! But 
>> can you please explain how to do some actions on the page on this method 
>> response? doCheckArtifact() will be run on server, how is it possible to 
>> customize its effect on the config page (e.g. - to disable an entry in 
>> another dropdown)?
>>
>> Also, can you tell more about the wrappers you mentioned, perhaps share a 
>> link?
>>
>> P.S. Another thing regarding dropdown selection change. 
>> http://javadoc.jenkins-ci.org/hudson/util/ListBoxModel.html says that 
>> one can use " "updateListBox" function, defined in hudson-behavior.js". 
>> This function doesn't seem to be there (
>> https://github.com/jenkinsci/jenkins/blob/master/war/src/main/webapp/scripts/hudson-behavior.js?source=cc).
>>  
>> Looks like the Javadoc is wrong?
>>
>> Regards,
>> Kirill.
>>
>> среда, 28 октября 2015 г., 2:14:34 UTC+2 пользователь Stephen Connolly 
>> написал:
>>>
>>> It cannot, as you have rendered the whole page before the user can 
>>> select anything and the tag was not written to support list filtering. 
>>>
>>> The way to handle this would be to use a "wrapper" for the first drop 
>>> down and then render the second drop down within the wrapper always... 
>>> that means you will have NxM of the second drop down instances, but 
>>> only ever one active at any point in time... 
>>>
>>> But that would be an ugly hack... 
>>>
>>> Are you sure you cannot think of another way to achieve this? 
>>>
>>> (e.g. could you *enable and disable* some of the second descriptors 
>>> via Javascript from a doCheckArtifact method's response? It would seem 
>>> reasonable to show the full list and grey out the ones that are not 
>>> valid for the artifact selection) 
>>>
>>> On 27 October 2015 at 15:34, Kirill <[email protected]> wrote: 
>>> > Hi noble Jenkins developers! 
>>> > 
>>> > It's quite easy to update one simple select (<f:select />) when 
>>> another is 
>>> > changed (see DynamicDropDownListBox from Jenkins UI Samples plugin). 
>>> But 
>>> > what about case when there are two <f:dropdownList/> elements? 
>>> > 
>>> > I have used DropdownList from UI Samples as a sample to create these: 
>>> > 
>>> >     <f:block> 
>>> >         <table> 
>>> >             <j:set var="currentArtifactDefinition" 
>>> > value="${instance.artifacts}"/> 
>>> >             <f:dropdownList name="artifacts" title="Artifact"> 
>>> >                 <j:forEach var="desc" 
>>> > items="${descriptor.artifactDescriptors}" varStatus="loop"> 
>>> >                     <j:set var="artifactDescription" 
>>> > value="${desc.class.name==currentArtifactDefinition.artifactsClassName?currentArtifactDefinition:null}"/>
>>> >  
>>>
>>> >                     <f:dropdownListBlock title="${desc.displayName}" 
>>> > value="${loop.index}" selected="${artifactDescription!=null}" 
>>> > staplerClass="${desc.entityClass.name}"> 
>>> >                         <st:include page="${desc.configPage}" 
>>> > from="${desc}"/> 
>>> >                     </f:dropdownListBlock> 
>>> >                 </j:forEach> 
>>> >             </f:dropdownList> 
>>> >         </table> 
>>> >     </f:block> 
>>> > 
>>> >     <f:block> 
>>> >         <table> 
>>> >             <j:set var="currentScheduleDefinition" 
>>> > value="${instance.schedule}"/> 
>>> >             <f:dropdownList name="schedule" title="Schedule"> 
>>> >                 <j:forEach var="desc" 
>>> > items="${descriptor.scheduleDescriptors}" varStatus="loop"> 
>>> >                     <j:set var="scheduleDescription" 
>>> > value="${desc.class.name==currentScheduleDefinition.scheduleClassName?currentScheduleDefinition:null}"/>
>>> >  
>>>
>>> >                     <f:dropdownListBlock title="${desc.displayName}" 
>>> > value="${loop.index}" selected="${scheduleDescription!=null}" 
>>> > staplerClass="${desc.entityClass.name}"> 
>>> >                         <st:include page="${desc.configPage}" 
>>> > from="${desc}"/> 
>>> >                     </f:dropdownListBlock> 
>>> >                 </j:forEach> 
>>> >             </f:dropdownList> 
>>> >         </table> 
>>> >     </f:block> 
>>> > 
>>> > There are two methods in Descriptor of the build step that has this 
>>> > config.jelly, they provide the data for both dropdowns: 
>>> > 
>>> >     public DescriptorExtensionList<MyBuildStep.ScheduleDefinition, 
>>> > Descriptor<MyBuildStep.ScheduleDefinition>> getScheduleDescriptors() { 
>>> >         return 
>>> > 
>>> Jenkins.getInstance().getDescriptorList(MyBuildStep.ScheduleDefinition.class);
>>>  
>>>
>>> >     } 
>>> > 
>>> >     public DescriptorExtensionList<MyBuildStep.ArtifactDefinition, 
>>> > Descriptor<MyBuildStep.ArtifactDefinition>> getArtifactDescriptors() { 
>>> >         return 
>>> > 
>>> Jenkins.getInstance().getDescriptorList(MyBuildStep.ArtifactDefinition.class);
>>>  
>>>
>>> >     } 
>>> > 
>>> > But how can I handle the change event in the first one to customize 
>>> the 
>>> > selection in the second one? 
>>> > 
>>> > -- 
>>> > 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/3744b377-beb9-4614-b6ec-8ac791b5e0a0%40googlegroups.com.
>>>  
>>>
>>> > 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-dev/389541f0-69a8-440f-81ce-db907b3710d1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-dev/389541f0-69a8-440f-81ce-db907b3710d1%40googlegroups.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/8e5e444d-1673-4444-85cf-13aaae46e711%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to