Address Field Type
Description:
The address
field type is used to capture structured address information with geocoding support. It provides a comprehensive interface for entering complete address details including street, city, state, postal code, and country. This field type ensures consistent address formatting and enables location-based features within your application.
Elasticsearch Mapping: object
with geo properties
YAML Definition
- name: customer_address
type: address
display: address
display_name: "Customer Address"
default_value: null
required: false
readonly: false
hidden: false
guidance: "Enter the customer's address"
country_list: ["uk", "us", "ca"]
validation: "address"
validation_message: "Please enter a valid address"
Attributes
-
name (string): Required.
The unique identifier for the field. -
type (string): Required.
Must be set toaddress
for address fields. -
display (string): Required.
Must be set toaddress
for address display. -
display_name (string): Optional.
The label displayed in the user interface. If not provided, a formatted version ofname
is used. -
guidance (string): Optional.
Help text or instructions for the field, assisting users in understanding what address to enter. -
required (boolean): Optional.
Iftrue
, the field must be filled before submission. Default:false
. -
readonly (boolean): Optional.
Iftrue
, the field is read-only and cannot be edited by the user. Default:false
. -
hidden (boolean): Optional.
Iftrue
, the field is hidden from the user interface. Default:false
. -
default_value (object): Optional.
The default address value displayed when the form is first loaded. -
country_list (array): Optional.
Array of country codes to restrict address selection to specific countries. -
validation (string): Optional.
Validation rules for the address field. -
validation_message (string): Optional.
Custom validation error message to display when validation fails.
Examples
Basic Address Field:
- name: customer_address
type: address
display: address
display_name: "Customer Address"
required: false
guidance: "Enter the customer's address"
country_list: ["uk", "us", "ca"]
Required Address Field:
- name: billing_address
type: address
display: address
display_name: "Billing Address"
required: true
guidance: "Enter the billing address for this account"
validation: "address"
validation_message: "Please enter a valid billing address"
Address Field with Specific Countries:
- name: shipping_address
type: address
display: address
display_name: "Shipping Address"
required: true
guidance: "Enter the shipping address"
country_list: ["us", "ca", "mx"]
validation: "address"
Readonly Address Field:
- name: verified_address
type: address
display: address
display_name: "Verified Address"
readonly: true
guidance: "This is the verified address on file"
Usage Notes
- Address Structure:
- The address field captures structured address components:
- Street address
- City
- State/Province
- Postal code
- Country
- Address components are validated and formatted according to country-specific rules.
- The address field captures structured address components:
- Country Restrictions:
- Use
country_list
to restrict address selection to specific countries. - Common country codes include:
"us"
for United States"uk"
for United Kingdom"ca"
for Canada"au"
for Australia"de"
for Germany"fr"
for France
- Use
- Geocoding Support:
- Address fields typically include geocoding capabilities.
- Automatically converts addresses to geographic coordinates.
- Enables location-based features and mapping integration.
- Validation:
- Use
validation: "address"
to enable address-specific validation. - Validates address format and completeness.
- Checks for valid postal codes and country combinations.
- Use
- Default Values:
- Use
default_value
to pre-fill address fields with common addresses. - Useful for company addresses or frequently used addresses.
- Use
- Required Fields:
- Set
required: true
for essential addresses like billing or shipping addresses. - Ensures complete address information is captured.
- Set
- Readonly Fields:
- Use
readonly
for verified or system-managed addresses. - Common for addresses that have been validated or are managed by the system.
- Use
- Use Cases:
- Customer Information: Customer addresses for contact and billing.
- Shipping: Delivery addresses for orders and packages.
- Billing: Billing addresses for invoices and payments.
- Service Areas: Service delivery addresses and coverage areas.
- Location Tracking: Address-based location services and mapping.
- Data Structure:
- Address data is stored as structured objects with individual components.
- Includes geographic coordinates for mapping and location services.
- Supports international address formats and validation.
- Internationalization:
- Supports address formats from different countries.
- Handles different postal code formats and address structures.
- Validates addresses according to country-specific rules.
- Integration:
- Integrates with mapping services for address verification.
- Supports address autocomplete and suggestion features.
- Enables distance calculations and location-based services.
- Accessibility:
- Ensure that address fields are keyboard accessible.
- Provide clear labels for each address component.
- Support screen readers for address entry and validation.
By incorporating the address
field type into your schema, you ensure consistent and accurate capture of address information, enabling location-based features and improving the user experience for address-related functionality.