I have a solution for you but it involves a few changes

you can define an option in the Autocompleter.local initialization called
"afterUpdateElement" - this will fire the function you define in that option

for example

new Autocompleter.Local('field1', 'field1_list',
source,{fullSearch:true,afterUpdateElement:foo2 });

foo2 is passed the DOM element that Autocompleter is tied to, in this
instance "field1"

so if you change foo2

function foo2(field) {

  var val=field.value;

 alert(val);            // 'jason'


}

it will alert the desired value - let me know if you have any questions



Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com



On Mon, Jul 2, 2012 at 9:55 AM, charles.desfor...@orange.fr <
charles.desfor...@orange.fr> wrote:

> Hi
>
> I am new on prototype and scriptaculos then I have a basic problem I
> guess.
>
> I try to catch through a handler the value selected in a
> "autocompleter.local" list.
> I succeed to get the initial written characters but not the complete
> string.
>
> For example I write 'ja' into field then  I select the 'jason' value
> listed
> I shall never get 'jason' only 'ja'       but strange:  if I use an
> alert() between two set instruction I get the right value then.
>
> Thank in advance for your answer
> CDesforges.
> Prototype v 1.7  Scriptaculos 1.9.0 on Fedora 11 x64
>
> These are elements of code
>
>
> function foo(event) {
>
>   var val=this.value;
>
>  alert(val);            // 'ja'
>
>  var val=this.value;
>
>  alert(val);            // 'jason'
>
>
> }
>
> function foo2(event) {
>
>   var val=this.value;
>
>  alert(val);            // 'ja'
>
>
> }
>
>  var source=['json','jason'];
>
> new Autocompleter.Local('field1', 'field1_list', source,
> {fullSearch:true });
>
> $('field1').observe('change', foo);
>
>
> --
> 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-scriptaculous@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-scriptaculous@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