-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Active-Choices v1.5.2
There appear to be cases where the value of an input style Reactive Reference is not available to Active Choices downstream.
The AC-Reactive Reference (lets call it REFA) returns formatted HTML with a simple Groovy script:
html='''<input id="refA" name="value" value="" class="setting-input" type="text" />''' return html
Before a downstream AC references the REFA value, the value is updated with a javascript button generated by an AC-Reactive Reference (lets call it JS_ACTION) using code like this:
html=""" <script type="text/javascript"> /* Function modifies value of REFA */ function modifyAction() { document.getElementById("refA").setAttribute("value",'MODIFIED BY JAVASCRIPT'); parentId=document.getElementById("refA").parentNode.id jQuery('#'+parentId).trigger('change') } </script> <div id="jsAction"> <input id="modRefA" type="button" value="MODIFY:REFA" onclick="modifyAction()"/> <p> </div> """ return html
Downstream another AC-Reactive Reference (lets call it REFB) is trying to use the value of REFA but it seems to be null. The REFB parameter uses code like the one shown below to guard for when REFA does not exist. The error is only generated when REFA has a value and so it is passed to the script binding. Otherwise the logic correctly bypasses the code that is using REFA.
if (!binding.variables.containsKey("REFA")){ // do something with REFA -throws an NPE only when the REFA value is set }
Surprisingly, the AC-Reactive Reference value is correctly passed to the build. The problem is it can't be used to drive other AC-parameters on the UI.
I have tried to document this with a simple use case, but I don't seem able to reproduce it. Most of the ideas I had as to the underlying causes were exhausted in trying to setup a test case without a useful test. Sorry, I'll try some more, but I wanted to document this as others may experience something similar.
- is related to
-
JENKINS-42677 AC Reactive Reference value returns null when contains an = sign
- Resolved