Add address autocomplete
Procedure
-
Create an
AddressAutocompleteHandlerinstance in the appropriate PCF file.You create the instance by calling the factory method gw.api.contact.AddressAutocompleteHandler.createHandler with the following arguments:
- A
Stringidentifying the field to complete - A comma-separated list of the reference fields, field names of the Address entity, that the application passes to the handler
- A
Booleanvalue that specifies whether PolicyCenter waits for a key press before fetching suggestions
- A
-
Edit the PCF file in Guidewire Studio and add the factory method in the
Variables tab of the
PCF widget, calling the method in the
initialValuefield.Suppose that you want to construct anAddressAutocompleteHandlercalledcityhandlerin the GlobalAddressInputSet.default.pcf file. In that case, you need to first add thecityhandlervariable in the Variables tab, then set its various fields as follows:- initialValue
-
contact.AddressAutocompleteHandler .createHandler("City","City,County,State,PostalCode,Country",true) - name
cityhandler- recalculateOnRefresh
false
Cityfield. The handler requires the following set of reference fields:City,County,State,PostalCode, andCountry. -
Edit the widget that uses the handler to specify which handler is responsible
for autofill in the
autoCompleteproperty and the arguments the handler expects in theautoCompleteArgIdsfield.For example, for AddressAutoFillInput: City:- action
-
gw.api.contact.AddressAutocompleteUtil .autofillAddress(addressOwner.AddressDelegate,"City") - actionAvailable
addressOwner.AutofillIconEnabled- autoComplete
cityhandler- autoCompleteArgIds
City,County,State,PostalCode,Country- available
addressOwner.isAvailable(fieldId.CITY)
AddressAutoFillInputwidget for the city field. This widget displays an autofill icon beside the field that acts as a cue. You do not have to use this specific type of widget for this purpose.
