Jump Autocomplete Implementation

This page is what makes the autocompletion go. This is derived from the example on JQueryAjaxHelper.

Client section

%STARTSECTION{"topicselector"}%
<input type="text" class="foswikiInputField foswikiDefaultText" name="%INPUT_NAME%" id="%INPUT_ID%" title="%INPUT_TITLE%" size="%IF{"defined INPUT_SIZE" then="size='%INPUT_SIZE%'" else="size='18'"}%" value="%IF{"defined INPUT_VALUE" then="%INPUT_VALUE%"}%" />
<script type="text/javascript">
jQuery(function() {
  $('#%INPUT_ID%').autocomplete({
    source: "%SCRIPTURL{"view"}%/%SYSTEMWEB%/JumpAutocompleteImpl?section=topic;skin=text;contenttype=application/json;web=all;%IF{"defined EXCLUDE" then="exclude=%EXCLUDE%"}%",
    select: function(event, ui) {
      window.location.href = "%SCRIPTURL{"view"}%/" + ui.item.value;
    }
  });
});
</script>
%ENDSECTION{"topicselector"}%

Server section

URL parameters
  • term: search term substring typed so far
  • limit: number of search results to return, defaults to 10
  • web: the web where to search for topics
  • exclude: exclude expression to filter out unwanted topics
%STARTSECTION{"topic"}%[%SEARCH{
  ".*%URLPARAM{"term" default="does not exist"}%.*"
  type="regex"
  scope="topic"
  format="<nop>%URLPARAM{"format" encode="quote" default="{\\"label\\":\\"$web/$topic\\", \\"webtopic\\":\\"$web.$topic\\"}"}%"
  separator=","
  limit="%URLPARAM{"limit" default="10"}%"
  nonoise="on"
  excludetopic="%URLPARAM{"exclude"}%"
  web="%URLPARAM{"web" default="all"}%"
}%]%ENDSECTION{"topic"}%
Topic revision: r3 - 08 Jan 2013, JeremyStephens
 

This site is powered by FoswikiCopyright © 2013 by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback