Well if it is a fixed parameter just use:
new Ajax.Autocompleter("autocomplete", "autocomplete_choices",
"processor_script", {
    paramName:"name",
    parameters:"param2=value2&param3=value3"
});
will result in "name=value&param2=value2&param3=value3"

The callback is useful if you need parameters from some other element or 
want to build them your own way:
Example:

<h3>Search</h3>
<form action="">
<select name="field">
    <option value="name">Person</option>
    <option value="company_name">Company</option>
    <option value="person_notes">Notes</option>
</select>
<select name="position">
    <option value="starts_with">starts with</option>
    <option value="contains">contains</option>
</select>
<input type="text" id="searchbox" class="autocomplete" name="searchstring"/>
<span id="indicator" style="display: none"><img 
src="/images/indicator.gif" alt="Working..." /></span>
<div id="autocomplete_choices" class="autocomplete"></div>
</form>
<div id="contact_details" style="display:none;"></div>
<script type="text/javascript">
    new 
Ajax.Autocompleter('searchbox','autocomplete_choices','people.php', {
        minChars: 2,
        frequency: 0.3,
        indicator: 'indicator',
        select: 'field',
        callback: function(element, entry){
            var form = element.form;
            return Form.serialize(form);
        },
        afterUpdateElement: function(field,element){
            Element.show('indicator');
            new Ajax.Updater('contact_details','people.php',{
                parameters:'id='+element.id,
                onComplete: function(xhr,obj){
                    var container = $('contact_details');
                    Element.hide('indicator');
                    if(!Element.visible(container))
                        new Effect.SlideDown(container,{duration: 0.3});
                }
            });
        }
    });
    $('searchbox').focus();
</script>



frank wrote:
> So what would it look like?
>
> new Ajax.Autocompleter("autocomplete", "autocomplete_choices",
> "processor_script", {paramName:"name" callback(paramName:"name2")});
>
> ?
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to