Navigation
MavSuggest v0.1.1 (A mootools more library)
MavSuggest is an autocomplete (or text suggestion) mootools library which is able to query it's results from a server-side script, or a local cache of JSON objects. The server-side script results can also be cached to allow for both a faster result, and less server traffic. There are many options to customize the text field and the search results to match the look and feel of your web-site or web application. Keyboard and mouse interactions make it as intuitive as using any other form field. Effects are optional for an even quicker response and display time.
Discussion
For now, all discussion will be located at the unofficial mootools forum. Partly because i think people will probably look there for it anyway, partly i hate setting up forums, and also because right now i'm feeling lazy. ^_^
Discuss MavSuggest on the unofficial mootools forumDownload MavSuggest
MavSuggest requires mootools v1.2+. You will need the class.MavSuggest.js, a CSS file that follows the example given below, but css class names are customizable, see the options section. If you are using a server-side script for results, see the example PHP file below as well. Neither PHP nor MySQL is required, and the server-side script can be written in any language you desire, so long as it returns a JSON object as it's output.
Get the newest Mootools Core Example CSS file MavSuggest Javascript (Uncompressed) Example PHP and MySQL script
Back to topExamples
Usage
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mavenous MavSuggest</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="mavsuggest.css" />
<style type="text/css">
body {
background: #fff;
padding: 0 5px !important;
font: 101%/1.3 tahoma,verdana,arial,sans-serif;
}
#music_select { width: 400px; height: 24px; font-size: 105%; }
#music_tags { width: 550px; height: 60px; }
</style>
<script type="text/javascript" src="mootools-1.2.1-core.js"></script>
<script type="text/javascript" src="class.MavSuggest.js"></script>
<script type="text/javascript">
var predict;
window.addEvent('load', function() {
predict = new MavSuggest.Request.JSON({
'append':'music_tags',
'elem':'music_select',
'tabSelect': false,
'url':'/library/public/mavsuggest/predict.php',
'width': 'auto'
});
$('music_select').focus();
});
</script>
</head>
<body>
<fieldset style="margin:20px auto;width:580px;padding:18px;">
<legend>MavSuggest Demo</legend>
<div style="padding:0px">
<div>
<strong>Type Genre</strong><br />
<input type="text" id="music_select" value="" />
</div>
<div>
<strong>Selected Genres</strong><br />
<textarea id="music_tags"></textarea>
</div>
</div>
</fieldset>
</body>
</html>
Back to top
Syntax
// Simplest usage syntax
new MavSuggest.Request.JSON({
'elem':'input_element',
'url':'/url/path/to/script.php'
});
Back to top
Arguments
-
JSON Object containing options
(Object)
An object containing the input element and additional options.
Returns
(Object)
MavSelect object(null)
If an error occurred.
Options
Back to topCompatibility
Tested and working with:- Firefox 2 / Firefox 3
- Google Chrome 1.0.154.59
- Internet Explorer 7
Changelog
-
v 1.0.5 - April 26th, 2009
- Initial public release version. Many bugs still to fix, and much more testing to be done.