I know that active choice supports javascript to modify the dom of jenkinse web UI in configuration panel. Like the pic shown. Reference
But how can I run javascript in active choice declarative pipeline? For example, if I want to disable the build button. The code should be like
[$class: 'DynamicReferenceParameter',
choiceType: 'ET_FORMATTED_HIDDEN_HTML',
name: 'Disable Button',
referencedParameters: 'A_checkbox_trigger',
script: [$class: 'GroovyScript',
fallbackScript: [
classpath: [],
sandbox: true,
script: fallback
],
script: [
classpath: [],
sandbox: true,
script: """return "${
def buildHTML = '''<script>
function custom(){
document.getElementById("yui-gen1-button").disabled=true
}
</script>'''
return buildHTML
}"
"""
]
]
]
Could someone give me a simple example how to render effects on jenkins page? THX