Skip to main content

betaThis is a new capability. Help us improve it and give your feedback on Slack.

Lat Long Field

Paired decimal inputs for collecting WGS84 latitude and longitude coordinates.

This component renders an inline Ordnance Survey map that lets users click a location to auto-populate the latitude and longitude inputs. The map requires the ordnanceSurveyApiKey and ordnanceSurveyApiSecret plugin options to be set — without them the component falls back to plain text inputs.

Preview

This component is progressively enhanced. The coordinate fields work without JavaScript. With JavaScript enabled, an interactive map lets users click to set their location.

To see the full experience, view our demo form which includes most components.

Enter a latitude and longitude

Map appears here with JavaScript enabled

JSON definition

{
"type": "LatLongField",
"name": "fieldName",
"title": "Question title",
"hint": "",
"shortDescription": "",
"options": {},
"schema": {}
}

Properties

PropertyTypeRequiredDescription
hintstringNoHint text displayed below the field label to help the user answer the question.
shortDescriptionstringNoA short description of the field used in the check-your-answers summary.

Options

PropertyTypeRequiredDescription
classesstringNoAdditional CSS classes applied to the component.
conditionstringNoName of a condition that controls whether this component is shown.
customValidationMessagestringNoA single custom message shown for any validation error on this field.
customValidationMessagesobjectNoA map of Joi error codes to custom error messages.
instructionTextstringNoAlternative text read by screen readers in place of the field title.
optionalTextbooleanNoWhen true, appends '(optional)' to the field label.
requiredbooleanNoWhether the field must be filled in. Defaults to true.

Schema constraints

PropertyTypeDescription
latitudeobjectLatitude constraints (min, max).
longitudeobjectLongitude constraints (min, max).