Auto-complete Fields

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Auto-complete Fields

Adrian Crum-3
I've been trying all day to get a simple auto-complete field to work
properly with no luck. Maybe someone can help me out. Here's the
Freemarker code:

<#include "component://widget/templates/htmlFormMacroLibrary.ftl">
<#assign postalCodeAjaxUrl =
requestAttributes._REQUEST_HANDLER_.makeLink(request, response,
"LookupGeoName")/>
<#assign postalCodeAjaxUrl = "EditCustRequest_postalCode," +
postalCodeAjaxUrl + ",geoTypeId=POSTAL_CODE&amp;ajaxLookup=Y" />
...
<@renderLookupField name="postalCode" formName="EditCustRequest"
fieldFormName="LookupGeoName" value="${(address.postalCode)?if_exists}"
size="24" maxlength="20" id="EditCustRequest_postalCode"
descriptionFieldName="geoName" ajaxUrl=postalCodeAjaxUrl/>

 From what I can tell, this should create an auto-complete field that
will be filled in with postal code geo names. Instead, the auto-complete
field is filled in with ALL fields and the auto-complete list contains
ALL geos. No matter what parameters I send to the lookup screen, I get
the same results.

Any ideas?

-Adrian

Reply | Threaded
Open this post in threaded view
|

Re: Auto-complete Fields

Jacques Le Roux
Administrator
Hi Adrian,

Did you find a solution? I had a quick look last week and it was not obvious to me as well

Jacques

From: "Adrian Crum" <[hidden email]>

> I've been trying all day to get a simple auto-complete field to work
> properly with no luck. Maybe someone can help me out. Here's the
> Freemarker code:
>
> <#include "component://widget/templates/htmlFormMacroLibrary.ftl">
> <#assign postalCodeAjaxUrl =
> requestAttributes._REQUEST_HANDLER_.makeLink(request, response,
> "LookupGeoName")/>
> <#assign postalCodeAjaxUrl = "EditCustRequest_postalCode," +
> postalCodeAjaxUrl + ",geoTypeId=POSTAL_CODE&amp;ajaxLookup=Y" />
> ...
> <@renderLookupField name="postalCode" formName="EditCustRequest"
> fieldFormName="LookupGeoName" value="${(address.postalCode)?if_exists}"
> size="24" maxlength="20" id="EditCustRequest_postalCode"
> descriptionFieldName="geoName" ajaxUrl=postalCodeAjaxUrl/>
>
> From what I can tell, this should create an auto-complete field that
> will be filled in with postal code geo names. Instead, the auto-complete
> field is filled in with ALL fields and the auto-complete list contains
> ALL geos. No matter what parameters I send to the lookup screen, I get
> the same results.
>
> Any ideas?
>
> -Adrian
>

Reply | Threaded
Open this post in threaded view
|

Re: Auto-complete Fields

Adrian Crum-3
Yes I did. It took a combination of small fixes that I committed plus
custom Geo screens.

The existing Ajax auto-complete system ignores URL parameters. So, I had
to create a custom Ajax auto-complete screen that copies URL parameters
to a Map called "conditionFields" that the auto-complete system expects
to see:

<set field="conditionFields.geoTypeId" from-field="parameters.geoTypeId"/>

-Adrian


On 7/9/2011 11:18 AM, Jacques Le Roux wrote:

> Hi Adrian,
>
> Did you find a solution? I had a quick look last week and it was not
> obvious to me as well
>
> Jacques
>
> From: "Adrian Crum" <[hidden email]>
>> I've been trying all day to get a simple auto-complete field to work
>> properly with no luck. Maybe someone can help me out. Here's the
>> Freemarker code:
>>
>> <#include "component://widget/templates/htmlFormMacroLibrary.ftl">
>> <#assign postalCodeAjaxUrl =
>> requestAttributes._REQUEST_HANDLER_.makeLink(request, response,
>> "LookupGeoName")/>
>> <#assign postalCodeAjaxUrl = "EditCustRequest_postalCode," +
>> postalCodeAjaxUrl + ",geoTypeId=POSTAL_CODE&amp;ajaxLookup=Y" />
>> ...
>> <@renderLookupField name="postalCode" formName="EditCustRequest"
>> fieldFormName="LookupGeoName"
>> value="${(address.postalCode)?if_exists}" size="24" maxlength="20"
>> id="EditCustRequest_postalCode" descriptionFieldName="geoName"
>> ajaxUrl=postalCodeAjaxUrl/>
>>
>> From what I can tell, this should create an auto-complete field that
>> will be filled in with postal code geo names. Instead, the
>> auto-complete field is filled in with ALL fields and the
>> auto-complete list contains ALL geos. No matter what parameters I
>> send to the lookup screen, I get the same results.
>>
>> Any ideas?
>>
>> -Adrian
>>
>