Is it possible to have fields in the GeoForm application automatically populate based upon information from a selection?
I have been building an app using ArcGIS API for Javascript 3.20 . In the application, when a user clicks on a feature, the popup appears with some information and a link to the GeoForm. If possible, it would be awesome if some of the fields in the form could be filled with information based on the user's selection.
geo forms geoform auto complete load data automatically arcgis-javascript-api #arcgis javascript api 3.20
Found a sort of round-about solution with the help of a coworker! Add the fields you want to automatically populate into the url (because I'm switching between two apps):
Added this script into the index.html:
<script>
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
</script>
Then added the following into the main.js file:
dom.byId('FORM FIELD HERE').value = getParameterByName('UID');