I have never used the AutoCompleter so I am assuming that when the auto completer sends its data to the server that something in POST or GET is "sid" on the other end....

The function...

function startAutocomplete(obj) {
var blah = $("the-selectbox").value(); // add this
ac.options.parameters='sid='+obj.value+'&select-box-value='blah; // change this
alert('The value of sid is: ' + ac.options.parameters
+ '.');
document.searchForm.sterm.value='';
}



Alex Mcauley
http://www.thevacancymarket.com
----- Original Message ----- From: "maxarbos" <maxar...@yahoo.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Tuesday, June 29, 2010 3:48 PM
Subject: [Proto-Scripty] Re: Ajax.Autocompleter


I'm not really following where this is to be used.
Within the Ajax.Autocompleter, there are a number of options that i
could set, one of them was 'parameters'
Where would your code be placed?
Also, i wanted the text box to be cleared each time the select was
changed, that is another reason for the 'onchange' function i have.

What I have is working now,but would like to see how this version
performs as well.
thanks.


On Jun 29, 10:35 am, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
All you needed to do was query the value of the select box each time the
AutoCompleter was triggered - the psudeo code I provided does just that ;)

Good luck
Alex Mcauleyhttp://www.thevacancymarket.com

----- Original Message -----
From: "maxarbos" <maxar...@yahoo.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Tuesday, June 29, 2010 2:48 PM
Subject: [Proto-Scripty] Re: Ajax.Autocompleter

That is what my funciton : onchange="startAutocomplete(this)" is
doing, the issue is that the parameters option was not changing on
submission even though if i ran tests to view the value after the
'onchange' , the new value was there.
I found the callback function and used that with some help from here.

Thanks for the response.

On Jun 29, 9:39 am, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
> 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 Mcauleyhttp://www.thevacancymarket.com

> ----- Original Message -----
> From: "maxarbos" <maxar...@yahoo.com>
> To: "Prototype & script.aculo.us"
> <prototype-scriptaculous@googlegroups.com>
> 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
prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group athttp://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 prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. 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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to