This is a set of simple helper applications that can be used in ajax wiki applications, i.e.
to fetch properties of dynamically populate jquery.autocomplete enabled input boxes.
 Form library 
 Topic selector 
 Parameters 
 
-  
INPUT_NAME: name of text input field
  -  
INPUT_VALUE: preselected value
  -  
EXCLUDE: exclude expression to filter out unwanted topics, see the docu of the excludetopic parameter in VarSEARCH
 
 
 Implementation 
%STARTSECTION{"topicselector"}%<!-- topicselector  -->
<input type="text" class="foswikiInputField" name="%INPUT_NAME%" id="%INPUT_NAME%" autocomplete="%SCRIPTURL{"view"}%/%SYSTEMWEB%/JQueryAjaxHelper?section=topic;contenttype=text/plain;skin=text;baseweb=%BASEWEB%;%IF{"defined EXCLUDE" then="exclude=%EXCLUDE%"}%" size="60" value="%IF{"defined INPUT_VALUE" then="%INPUT_VALUE%"}%" />
<!-- //topicselector -->%ENDSECTION{"topicselector"}%
 Test 
 Web selector 
 Parameters 
 
-  
INPUT_NAME: name of text input field
  -  
INPUT_VALUE: preselected value
  -  
EXCLUDE: exclude expression to filter out unwanted topics, see the docu of the excludetopic parameter in VarSEARCH
 
 
 Implementation 
%STARTSECTION{"webselector"}%<!-- webselector  -->
<input type="text" class="foswikiInputField {matchCase:true}" name="%INPUT_NAME%" id="%INPUT_NAME%" autocomplete="%SCRIPTURL{"view"}%/%SYSTEMWEB%/JQueryAjaxHelper?section=web;contenttype=text/plain;skin=text;%IF{"defined EXCLUDE" then="exclude=%EXCLUDE%"}%" size="60" value="%IF{"defined INPUT_VALUE" then="%INPUT_VALUE%"}%" />
<!-- //webselector -->%ENDSECTION{"webselector"}%
 Test 
 Jump box 
 Parameters 
 
-  
INPUT_NAME: name of text input field, defaults to jumpbox
  -  
GLOBAL: toggle search for topics in all webs on/off, defaults to off
 
 
 Implementattion 
%STARTSECTION{"jumpbox"}%<!-- jumpbox -->
<input type="text" class="foswikiInputField" name="%IF{"defined INPUT_NAME" then="%INPUT_NAME%" else="jumpbox"}%" id="%IF{"defined INPUT_NAME" then="%INPUT_NAME%" else="jumpbox"}%" autocomplete="off" size="60" />
<script type="text/javascript">
(function($){
  $(function(){
    $("#%IF{"defined INPUT_NAME" then="%INPUT_NAME%" else="jumpbox"}%").autocomplete(
      "%SCRIPTURL{"view"}%/%SYSTEMWEB%/JQueryAjaxHelper?section=topic;contenttype=text/plain;skin=text;%IF{"'%GLOBAL%' = 'on'" then="baseweb=all;format=$web/$topic" else="baseweb=%BASEWEB%;format=$topic"}%"
    ).result(function(event, item) {
      window.location.href="%SCRIPTURLPATH{"view"}%/%IF{"'%GLOBAL%' != 'on'" then="%BASEWEB%/"}%"+item;
    });
  });
})(jQuery);
</script>
<!-- //jumpbox -->%ENDSECTION{"jumpbox"}%
 Test 
 User selector 
 Parameters 
 
-  
INPUT_NAME: name of text input field
  -  
INPUT_VALUE: preselected user
  -  
MULTIPLE: true/false - select multiple users
 
 
 Implementation 
%STARTSECTION{"userselector"}%<!-- userselector -->
<input type="text" class="foswikiInputField" name="%INPUT_NAME%" id="%INPUT_NAME%" autocomplete="off" size="60" value="%IF{"defined INPUT_VALUE" then="%INPUT_VALUE%"}%" />
<script type="text/javascript">
(function($){
  $(function(){
    $("#%INPUT_NAME%").autocomplete(
      "%SCRIPTURL{"view"}%/%SYSTEMWEB%/JQueryAjaxHelper?section=user_fast;contenttype=text/plain;skin=text",
      {
        autoFill:false,
        selectFirst:false,
        scrollHeight:250,
        %IF{"not isempty MULTIPLE" then="multiple: true," else="/* single select */"}%
        formatItem: function(row, index, max, search) {
          return "<table width='100%'><tr><td width='60px'><img width='50' src='"+row[2]+"' /></td><td>"+row[0]+"<br />"+row[1]+"</td></tr></table>";
        }
      }
    );
  });
})(jQuery);
</script>
<!-- //userselector -->%ENDSECTION{"userselector"}%
 Test 
 Autocomplete backends 
These are best called using a view url of the following format
%SCRIPTURLPATH{"view"}%/%SYSTEMWEB%/JQueryAjaxHelper?contenttype=text/plain;skin=text;section=<backend>;<parameters>
You could also make use of 
Foswiki:Extensions/RenderPlugin to implement any of the below backends in a more flexible way.
Note, that jquery.autocomplete will always add a 
q url param to the end of this string.
 Topic selector 
 Url parameters 
 
-  
q: search term substring typed so far
  -  
limit: number of search results to return, defaults to 10
  -  
baseweb: the web where to search for topics
  -  
format: format of returned values, defaults to $topic
  -  
exclude: exclude expression to filter out unwanted topics
 
 
 Implementation 
%STARTSECTION{"topic"}%%SEARCH{
  "^%URLPARAM{"q" default="does not exist"}%.*"
  type="regex"
  scope="topic"
  format="<nop>%URLPARAM{"format" default="$topic"}%"
  separator="$n"
  limit="%URLPARAM{"limit" default="10"}%"
  nonoise="on"
  excludetopic="%URLPARAM{"exclude"}%"
  web="%URLPARAM{"baseweb" default="%BASEWEB%"}%"
}%%ENDSECTION{"topic"}%
 Web selector 
Needs Foswik:Extensions/FlexWebListPlugin
 Url parameters 
 
-  
q: search term substring typed so far
  -  
limit: number of search results to return, defaults to 10
 
 
 Implementation 
%STARTSECTION{"web"}%%FLEXWEBLIST{
  include="%URLPARAM{"q" default="does not exist"}%.*"
  exclude="%URLPARAM{"exclude"}%"
  limit="%URLPARAM{"limit" default="10"}%"
  format="<nop>$web"
  separator="$n"
  subheader="$n"
}%%ENDSECTION{"web"}%
 User and Group selector 
 Url parameters 
 
-  
q: search term substring typed so far
  -  
limit: number of search results to return, defaults to 10
 
 
 Implementation (SEARCH-based) 
%STARTSECTION{"user"}%%SEARCH{
   "^%URLPARAM{"q" default="does not exist"}%.*"
   type="regex"
   scope="topic"
   format="$percntUSERINFO{\"$topic\" format=\"<nop>$dollarwikiname|$dollaremails|$percntFORMFIELD{\"Photo\" topic=\"$web.$topic\" default=\"%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/plugins/ifixpng/images/pixel.gif\" alttext=\"%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/plugins/ifixpng/images/pixel.gif\"}$percnt$n\"}$percnt"
   separator=""
   limit="%URLPARAM{"limit" default="10"}%"
   nonoise="on"
   web="%USERSWEB%"
}%%ENDSECTION{"user"}%
 Implementation (DBQUERY-based) 
%STARTSECTION{"user_fast"}%%DBQUERY{
   "uc(topic) =~ uc('^%URLPARAM{"q" default="does not exist"}%')"
   format="$percntUSERINFO{\"$topic\" format=\"<nop>$dollarwikiname|$dollaremails|$expand(Photo or '%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/plugins/ifixpng/images/pixel.gif')$n\"}$percnt"
   separator=""
   limit="%URLPARAM{"limit" default="10"}%"
   web="%USERSWEB%"
}%%ENDSECTION{"user_fast"}%
 Misc 
 Formfield 
Fetch a formfield from a topic asynchronously.
 Url parameters 
 
-  
source: source topic 
  -  
formfield: name of formfiled to retrieve
 
 
 Implementation 
%STARTSECTION{"formfield"}%%FORMFIELD{
  "%URLPARAM{"formfield" default="does not exist"}%"
  topic="%URLPARAM{"source" default="does not exist"}%"
}%%ENDSECTION{"formfield"}%
 User photo 
This one returns an 
<img...> to a user's photo. See the User selector example above.
 Url parameters 
 
-  
name: name of user
  -  
height: image height, defaults to 50
 
 
 Implementation 
%STARTSECTION{"userphoto"}%<img src='%FORMFIELD{"Photo" topic="%USERINFO{"%URLPARAM{"name" default="does not exist"}%" format="$wikiusername"}%" default="%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/plugins/ifixpng/images/pixel.gif" alttext="%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/plugins/ifixpng/images/pixel.gif"}%' alt='%URLPARAM{"name"}%' height='%URLPARAM{"height" default="50"}%' />%ENDSECTION{"userphoto"}%
