Skip to content

Commit

Permalink
Item10302:
Browse files Browse the repository at this point in the history
   * now defaulting to jquery-1.6.3
   * fixed autocomplete backend in example



git-svn-id: http://svn.foswiki.org/trunk@12512 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Sep 12, 2011
1 parent 23c1dc8 commit fcb791e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
9 changes: 5 additions & 4 deletions JQueryPlugin/data/System/JQueryUIAutocomplete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,21 @@ var countryList = [
This implementation extracts the list of countries from %SYSTEMWEB%.CountryList:

<verbatim class="tml">
%STARTSECTION{"data"}%%SEARCH{
"^\| .*%URLPARAM{"term"}%.* \| *$"
%STARTSECTION{"data"}%<noautolink>
%SEARCH{
"^\| [^\*].*%URLPARAM{"term"}%.* \| *$"
web="%SYSTEMWEB%"
topic="CountryList"
type="regex"
multiple="on"
nonoise="on"
casesensitive="off"
header="["
format="\"$pattern(.*?\| ([^\|]*).*)\""
format="\"$pattern(.*?\| ([^\|]*) \|.*)\""
separator=", "
footer="]"
}%
%ENDSECTION{"data"}%
</noautolink>%ENDSECTION{"data"}%
</verbatim>

See http://jqueryui.com/demos/autocomplete/ for more demos.
3 changes: 2 additions & 1 deletion JQueryPlugin/data/System/JQueryValidate.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1311336492" format="1.1" reprev="3" version="4"}%
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1315837703" format="1.1" reprev="3" version="6"}%
%META:TOPICPARENT{name="JQueryPlugin"}%
---+ %TOPIC%
%JQPLUGINS{"validate"
Expand Down Expand Up @@ -36,4 +36,5 @@ Very powerful client-side form validation framework
</div>
</div>
</form>

%IF{"'%URLPARAM{"dateofbirth"}%'!=''" then="<div class='foswikiSuccessMessage'>Thanks.</div>"}%
2 changes: 1 addition & 1 deletion JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Config.spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $Foswiki::cfg{JQueryPlugin}{NoConflict} = 0;
$Foswiki::cfg{JQueryPlugin}{DefaultPlugins} = '';

# **SELECT jquery-1.4.3, jquery-1.4.4, jquery-1.5, jquery-1.5.1, jquery-1.5.2, jquery-1.6.1, jquery-1.6.2, jquery-1.6.3**
$Foswiki::cfg{JQueryPlugin}{JQueryVersion} = 'jquery-1.4.3';
$Foswiki::cfg{JQueryPlugin}{JQueryVersion} = 'jquery-1.6.3';

# **SELECT ,base, flickr, foswiki, lightness, redmond, smoothness**
$Foswiki::cfg{JQueryPlugin}{JQueryTheme} = 'foswiki';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,25 @@ jQuery(function($) {

// get result from backend
$.log("AUTOCOMPLETE: requesting '"+term+"' from "+opts._source);
lastXhr = $.getJSON(opts._source, request, function(data, status, xhr) {
cache[cacheKey] = data;
$.log("AUTOCOMPLETE: caching "+term);

// throw away response if there already was a newer one
if (xhr === lastXhr) {
$.log("AUTOCOMPLETE: got data for '"+term+"' from backend");
response(data);
} else {
$.log("AUTOCOMPLETE: throwing away results for '"+term+"'");
lastXhr = $.ajax({
url: opts._source,
dataType: 'json',
data: request,
success: function(data, status, xhr) {
cache[cacheKey] = data;
$.log("AUTOCOMPLETE: caching "+term);

// throw away response if there already was a newer one
if (xhr === lastXhr) {
$.log("AUTOCOMPLETE: got data for '"+term+"' from backend");
response(data);
} else {
$.log("AUTOCOMPLETE: throwing away results for '"+term+"'");
}
},
error: function(xhr, status, error) {
alert("Error: "+status);
response();
}
});
};
Expand Down

0 comments on commit fcb791e

Please sign in to comment.