On Sep 8, 2010, at 12:10 PM, Jacques Le Roux wrote:

> I 1st tried to use it where it can be used (in the Java context, since it 
> can't be used in the Ajax/DOM context as it's not there
> anymore, and that's what I mean by "useless in the autocomplete context") and 
> tried to play with it in
> ModelFormField.renderLookupField where the autoCompleterTarget is used to 
> build the updateAreas (which is used after by
> createAjaxParamsFromUpdateAreas to create the ajaxUrl(s) where all things 
> are).
> 
> But the problem here is that it (Prototype Ajax.autocompleter) all depends on 
> the action on the field (2d arg of
> ModelForm.UpdateArea). We don't have any actions from the user on the other 
> field (only letter typed in the lookup field are
> handled by the autocompleter). I thought that I could find a way to trigger 
> an action later in the process on the other field (passed in updateAreas) but 
>  gave up at this stage because anyway I would still need to fill the field... 
> There is maybe another way, but I did not find it in the limited time I 
> assigned to this. That's why I decided to use this hack.
> 
> In other words, there is no means in Prototype Ajax.autocompleter to fill a 
> second field with a value of your choice grabbed during
> the server call. The afterUpdateElement callback (called setSelection in our 
> case) has only "two parameters, the input field
> specified for autocompletion, and the selected item (the <li> item 
> selected)". There are no places for the description-field-name.
> So we have to put a hack in the callback to handle the change in the other 
> field. It's the same in jQuery Autocomplete where
> afterUpdateElement is named select, but there maybe something called change 
> could be used (I doubt). Anyway the same problem arises: where is the field 
> we want  to change and the value to put in it?  If I missed something I would 
> be happy to learn...

Yes, one way or another that method will need access to the information. It's 
just code, so there's always a way...

It may be possible to put the information in a separately available structure 
to avoid changing the Ajax.autocompleter code.

-David

Reply via email to