Hi,
Sorry, i'm a little late with my response.
Did the suggestion by Nino work?
If it works, i would like to know more details about it.
If not, we already had a somehow similar problem (Swiss addresses), and we
have a different solution already working. Perhaps it can help you too.
Regards,
German
It seems that Nino Saturnino Martinez Vazquez Wael wrote:
> NP, waiting with excitement to hear if it works:)
>
> Oliver Lieven wrote:
>> Thanks allot for your efforts and detailed answer! Sounds good, I'll
>> give it
>> a try.
>>
>>
>> Nino.Martinez wrote:
>>
>>> No what I meant was that when a user selects something in one of your
>>> auto complete fields they'll automatickly select something in both,
>>> might have been a little scares on information:
>>>
>>> IModel commonModel=new Model();
>>>
>>>
>>> AbstractModel() Text=new AbstractModel(){
>>>
>>> getObject{
>>> return commonModel.getObject.Text;
>>> }
>>> setObject(obj){
>>> commonModel.setObject(obj)
>>> }
>>>
>>> }
>>>
>>>
>>> AbstractModel() name=new AbstractModel(){
>>>
>>> getObject{
>>> return commonModel.getObject.name;
>>> }
>>> setObject(obj){
>>> commonModel.setObject(obj)
>>> }
>>>
>>> }
>>>
>>>
>>>
>>> AutoCompleteTextField phoneName = new AutoCompleteTextField(
>>> "phoneName", name,
>>> new BestEffortRendererAutoCompleteRenderer()) {
>>> @Override
>>> protected Iterator getChoices(String input) {
>>>
>>> return findItems(input);
>>> }
>>> };
>>>
>>>
>>> AutoCompleteTextField phoneSeries = new AutoCompleteTextField(
>>> "phoneName", text,
>>> new BestEffortRendererAutoCompleteRenderer()) {
>>> @Override
>>> protected Iterator getChoices(String input) {
>>>
>>> return findItems(input);
>>> }
>>> };
>>>
>>> And ofcourse you need to add the other completefield to the
>>> ajaxresponse...
>>>
>>> Hope this pseudo code works a little better... Was on my way out the
>>> door before...
>>>
>>>
>>> Oliver Lieven wrote:
>>>
>>>> Hi Nino,
>>>> thanks for your fast reply. Yes, a shared PropertyModel would help to
>>>> keep
>>>> both fields synchronized.
>>>>
>>>> I still can't see how this could help me to determine the value
>>>> selected
>>>> by
>>>> the user.
>>>> The AutoComplete works like
>>>>
>>>> 1. getChoices() is called to populate the autocomplete list with my
>>>> "zipcode
>>>> - city" options
>>>> 2. when user selects a value from the autocomplete list, the
>>>> corresponding
>>>> field is set with the "textvalue" (e.g. the 'city' field is filled
>>>> with
>>>> the
>>>> city's name)
>>>> 3. because of this update, the city-field's
>>>> AjaxFormComponentUpdatingBehavior.onUpdate() is called
>>>> 4. in onUpdate() the getConvertedInput() method returns the city name,
>>>> which
>>>> is insufficient to determine the corresponding zipcode (because of the
>>>> n:1
>>>> relation (city may have many zipcodes)).
>>>>
>>>> So I'm still looking for a way to determine the exact combination
>>>> selected
>>>> by the user...
>>>>
>>>> regards,
>>>> Oliver
>>>>
>>>>
>>>> Nino.Martinez wrote:
>>>>
>>>>
>>>>> Quick answer, why not use property models and use both in the fiields
>>>>> you mention?
>>>>>
>>>>> Oliver Lieven wrote:
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> in an address edit panel I've got the two AutoCompleteText fields
>>>>>> 'zipcode'
>>>>>> and 'city'.
>>>>>>
>>>>>> When a users begins typing into the zipcode-field, the autocomplete
>>>>>> shows
>>>>>> up
>>>>>> and offers valid "zipcode - city" combinations. After selecting a
>>>>>> value
>>>>>> from
>>>>>> the autocomplete the 'zipcode' is set. Same for 'city' field, i.e.
>>>>>> after
>>>>>> selecting a "zipcode - city" from the city's autocomplete the
>>>>>> "city"-field
>>>>>> is set accordingly.
>>>>>> (Thanks for the great autocomplete-support in Wicket which allows
>>>>>> separation
>>>>>> of displayvalue and textvalue!)
>>>>>>
>>>>>> Now to my question: after selection of a "zipcode - city"
>>>>>> combination
>>>>>> from
>>>>>> either autocomplete list I would like to set both fields (zipcode
>>>>>> and
>>>>>> city).
>>>>>> I already attached an AjaxFormComponentUpdatingBehavior which gets
>>>>>> called
>>>>>> after a selection in the autocomplete list, but it just gets the
>>>>>> zipcode/city currently set.
>>>>>> Since the zipcode-city relation is 1:n (e.g. Berlin has many
>>>>>> zipcodes)
>>>>>> I'm
>>>>>> wondering if there is a way to access the full selected value (and
>>>>>> not
>>>>>> only
>>>>>> the AbstractAutoCompleteTextRenderer.textvalue set).
>>>>>>
>>>>>>
>>>>>> Thanks for any help and tips!
>>>>>> Oliver
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]