views:

61

answers:

1

Is there a way to fire up Scriptaculous's Autocomplete to search with the default word from the inputfield when the page is loaded?

Something like this?

<input type="text" id="autocomplete" class="autocomplete_input" name="autocomplete_parameter" value="friends"/>
<span id="indicator1" style="display: none">
loading
</span>
<div id="autocomplete_choices" class="autocomplete">

</div>
<script type="text/javascript">
function AutoComp() {
var myAutoCompleter = new Ajax.Autocompleter("autocomplete", "autocomplete_choices",         "url", {indicator: 'indicator1',});
}
document.onLoad = AutoComp.activate();
</script>
A: 

My fault!

var myAutoCompleter = new Ajax.Autocompleter("autocomplete", "autocomplete_choices", "api/usersearch/", {indicator: 'indicator1'});

document.observe("dom:loaded", function() {
myAutoCompleter.activate();
});
</script>

This did the trick

Jelle