Hello everyone,
I'm trying to automatically fill the input fields of Editor Widget with the address information. I use the locator to get the address and lat/long. The editor widget and locator work well separately in the application. All my previous attempts to add the results from the locator into the input fields of the form template of the editor widget have failed. My problem is that I cannot transfer the results from the locator to the ExpressionInfos and then further into the Field Elements.
I looked at the following examples e.g. (Editing with calculated field expressions | Sample Code | ArcGIS Maps SDK for JavaScript 4.28 | ArcG..., Edit features with the Editor widget | Sample Code | ArcGIS Maps SDK for JavaScript 4.28 | ArcGIS De...). Does anyone have any idea how can I solve this problem? I am very grateful for every hint!
Here is my code:
Solved! Go to Solution.
So, after taking a few days to read all the ArcGIS JS API documentation regarding the Editor Widget, Sketch Widget, Feature Form Widget, Feaure Templates and all their view models, methods and events, in the end I succeeded. If anyone else wants to use this advanced functionality of the Editor Widget (version ArcGIS JS API 4.28) (in the web app builder as part of the Smart Editor Widget), here is the code. I hope that this self-understanding functionality will be implemented as a standard "property" in the editor widget at some point. When new features are recorded, in addition to special data, the address, coordinates and date are usually recorded. Nowadays, app users expect that when they create a new object, they don't at least have to type in the address. By the way, this reduces typing errors and data administration. That's why I needed it and was important to me to implement. As I said, I hope this functionality will come standard in the next versions of the ArcGIS JS API. Nevertheless, I would like to give a lot of praise to the ESRI ArcGIS JS API development team because they always leave a “way” open to implement the desired functionality themselves if necessary, even if it is painful for days. 👏😊
viewMap.when(() => {
So, after taking a few days to read all the ArcGIS JS API documentation regarding the Editor Widget, Sketch Widget, Feature Form Widget, Feaure Templates and all their view models, methods and events, in the end I succeeded. If anyone else wants to use this advanced functionality of the Editor Widget (version ArcGIS JS API 4.28) (in the web app builder as part of the Smart Editor Widget), here is the code. I hope that this self-understanding functionality will be implemented as a standard "property" in the editor widget at some point. When new features are recorded, in addition to special data, the address, coordinates and date are usually recorded. Nowadays, app users expect that when they create a new object, they don't at least have to type in the address. By the way, this reduces typing errors and data administration. That's why I needed it and was important to me to implement. As I said, I hope this functionality will come standard in the next versions of the ArcGIS JS API. Nevertheless, I would like to give a lot of praise to the ESRI ArcGIS JS API development team because they always leave a “way” open to implement the desired functionality themselves if necessary, even if it is painful for days. 👏😊
viewMap.when(() => {
I really appreciate you posting the solution when you found it. Many people don't, and it's a shame. Could you format the code in a code block?
Yes I agree with you. here is the codepen ArcGIS Maps SDK for JS - Editor Widget with Locator (codepen.io)
Thank you for this sample @Den-GIS. I had a similar app need that would pull locator data based on the users address search. The features are created client side and displayed via popup. After seeing your sample, I might switch from a popup to a featureformviewmodel to allow for additional user input. Here is the code pen if it helps anyone. https://codepen.io/Treemapper/pen/abMgLNW