you need to return the value in realt time ... for example in the auto completer....

'the_select_box_value' : function () {return $('the-select-box-id').value()},

Hope this helps

Alex Mcauley
http://www.thevacancymarket.com

----- Original Message ----- From: "maxarbos" <[email protected]>
To: "Prototype & script.aculo.us" <[email protected]>
Sent: Monday, June 28, 2010 8:25 PM
Subject: [Proto-Scripty] Ajax.Autocompleter


Hello,

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",
                                    "autocomplete_choices",
                                    "/Property/search/
ajaxAutoComplete",
                                     { parameters:
'sid='+cat_id }  );

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

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


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
submitted.

Thanks.

--
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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.



--
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to