I am trying to use Autocompleter to search through different tables.
Hardcoding a specific table returns expected results from that table,
so the script is working as expected.

What i want to do is, use a select box with an 'onchange' event that
passes the chosen value to the Ajax.Autocompleter object. the value is
use to create a 'parameters: "id="+xxx'  string that should be used in
the Ajax.Autocompleter object.

Here is what i have:

            window.onload = function() {
                var cat_id=88;
              ac = new Ajax.Autocompleter("sterm",
                                      { parameters:
'sid='+cat_id }  );

              alert('The value of ac parameters is: ' +
ac.options.parameters + ' and options are: ' + ac.options.toSource() +

            function startAutocomplete(obj) {
              alert('The value of  sid is: ' + ac.options.parameters
+  '.');

and on my select box: onchange="startAutocomplete(this)"

All the alert boxes are showing the correct information, but when I
type anything in the textfield to be 'autocompleted',  parameters:
'sid=88' is only being sent.
if i leave out the 'parameters: 'sid='+cat_id'  no parameters string
is sent at all.

Is there any way to change the value on the fly of the parameters
being sent?

I tried creating a new Ajax.Autocompleter onchange, but that only
created new ones ever time i changed the list but still keep the
original ones, so multiple instances of Ajax.Autocompleter were being


You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to