Last active
May 21, 2024 15:34
-
-
Save Crocoblock/d2893dcf7b2b72ee1ca4c97204197a0b to your computer and use it in GitHub Desktop.
JetFormBuilder Map field set coordinates and zoom level programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//assuming the ID of the form is 1709, and map field name if 'map1' | |
const formId = 1709; | |
const mapFieldName = 'map1'; | |
const observable = JetFormBuilder[ formId ]; | |
const mapField = observable.getInput( mapFieldName ); | |
//set coordinates | |
mapField.value.current = { | |
lat: 50.0, | |
lng: 30.0 | |
} | |
mapField.callable.render(); | |
//set zoom | |
mapField.fieldSettings.zoom = 10; | |
mapField.callable.render(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment