π§ Front-End Entry Form
How to update from Smart Map to Google Maps
Follow the instructions below to learn how to update to the new Google Maps plugin...
Technically, the syntax did not change at all. But since Craft itself has evolved, it's now possible to use an input
function for each subfield.
For example, here's a single subfield using the input
Twig function...
{# Visible subfield input (eg: "street1") #}
{{ input('text',
'fields[myAddressField][street1]',
entry.myAddressField.street1 ?? null,
{
placeholder: 'Street Address',
id: 'address-street1'
}
) }}
You can also set an input
to be hidden
. Certain subfields (ie: formatted
and raw
) can be hidden from view, as long as their values are still being submitted with the form.
{# Hidden subfield input (eg: "raw") #}
{{ input('hidden',
'fields[myAddressField][raw]',
entry.myAddressField.raw ?? null,
{
id: 'address-raw'
}
) }}
Make sure that each individual Address subfield is accounted for.
New Documentation
See the complete new Front-End Form documentation.