Listas escreveu:> Hi All
>
>
> Is there any way to pass a dynamic parameter do AutoCompleter URL?
>
> I want to pass the current text on autocompleter input field plus a
> parameter "last", with data from field "last"
>
> When i try to use "parameters" option, they get only first value
of
> field "last", not dynamicaly.
>
>
> Thanks.
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
Well, i don''t know if is there any other way, but i got this working
with some hacks! :D
i really don''t know NOTHING about javascript, so it''s my first
''script''
block :)
changes on controls.js:
about line 56, add:
this.options.jparms = this.options.jparms || null; // in
the future, this will be a array alowing multiple dynamic parameters.
about line 332:
before:
new Ajax.Request(this.url, this.options);
add this:
// Hacked by Jonis
if (this.options.jparms) {
var jtmp = document.getElementById(this.options.jparms);
this.options.parameters += ''&'' + jtmp.name +
''='' +
jtmp.value;
}
So, when you create a new autocompleter object, you have new option
called ''jparms'', wich is a (string) id of element that you
want to pass
value dynamically to request.
Well, works for me :)