Form autocomplete does not pass expected query parameters

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Form autocomplete does not pass expected query parameters

stephenshank
I am attempting to use the text box auto completion feature based on the example provided in the ui-samples plugin here. 

In the jelly file one of the entries is this:
<f:entry field="projectId" title="${%Project ID}">
<f:textbox/>
</f:entry>

Then in the Descriptor there is a method with this header:
public AutoCompletionCandidates doAutoCompleteProjectId(
@AncestorInPath Jenkins context,
@QueryParameter("projectId") final String projectId,
@QueryParameter("credentialsId") final String credentialsId)

When I look at the requests generated in my plugin, I see requests like this:
http://.../descriptorByName/<descriptor name>/autoCompleteProjectId?value=asdf

However for the form validation doCheckProjectId which uses the same query parameters I see requests like this:
http://.../descriptorByName/<descriptor name>/checkProjectId?value=asdf&projectId=asdf&credentialsId=...

The behavior of doFillXXXItems is the same as doCheckXXX in that I can specify other query parameters which are
other entries in the same form, and update the contents of the drop down dynamically. I'd like to be able to determine
the autocomplete candidates in a similar way, but right now the end result is that the Stapler response body has an
empty list of suggestions because my method returns an and empty list when the credentialsId is null.

I'm trying to figure out what the source of this discrepancy is. I understand that this uses the YUI autocomplete feature 
and I have a hunch that this fact is a huge part of the answer. I searched the jenkinsci organization on github and it 
seems that almost no one has deviated from using the query parameter "value", and the one that I saw did not use more 
than one query parameter. When I look up "jenkins autocomplete" I find references in various forms to the ui-samples plugin
above, or to JIRA issues about preventing auto completion of secure fields. 

If anyone else has tried to dynamically update the autocomplete candidates based on other entries in a form that would be 
helpful. I'd also be happy to hear a definitive "no, this functionality is not supported at the moment", file a feature request, and 
go back to using a drop down but that isn't ideal. Taking a step back, it would be nice to have "doFillXXX" for textboxes based 
on other fields in a form but that is something I do know isn't supported.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/4ff10c97-542a-488e-84dc-11fb13c39b36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.