Select to view content in your preferred language

Collect data from user using popop or infor Window

1105
7
Jump to solution
01-08-2014 07:05 AM
JohnPreston
Deactivated User
Hi, I would like the user to click on feature on map which opens a popup or info window where they enter in data. The data is then saved when user clicks button (or something). Is there a way to collect data this way? An example (or point me to an example) would be great, thanks!
0 Kudos
1 Solution

Accepted Solutions
JonathanUihlein
Esri Regular Contributor
You could create a template for the infoWindow/Popup to generate an html5 form on feature selection.

I do something similar in a small app with html5 checkboxes and a submit data button on an infoWindow.

[ATTACH=CONFIG]30363[/ATTACH]

View solution in original post

0 Kudos
7 Replies
KenBuja
MVP Esteemed Contributor
Are you thinking of an application like this that uses the Attribute Inspector?
0 Kudos
JohnPreston
Deactivated User
It's close...I don't need to edit the layer, I want to save the data to a SQL database.
0 Kudos
SteveCole
Honored Contributor
Jquery has a modal form which you might be able to use to collect your user's input. Dojo also has a Dialog Dijit that can serve the same purpose.
0 Kudos
JohnPreston
Deactivated User
Thanks Steve, I can easily create a popup using jquery to have the user enter data, what I liked about using a arcgis popup was that when you click on the map it may select more than one feature and the popup allows you to select the feature.
0 Kudos
JonathanUihlein
Esri Regular Contributor
You could create a template for the infoWindow/Popup to generate an html5 form on feature selection.

I do something similar in a small app with html5 checkboxes and a submit data button on an infoWindow.

[ATTACH=CONFIG]30363[/ATTACH]
0 Kudos
JohnPreston
Deactivated User
Thanks jon, That is what i am looking for. Do you have an exmple of code you could point me to?
0 Kudos
JonathanUihlein
Esri Regular Contributor
I wrote my own reusable dijit with accompanying template so it's a fairly complex sample to post on here.

Found some easier solutions that are less customizable but do nearly the same thing.

https://developers.arcgis.com/en/javascript/jssamples/widget_extendInfowindow.html

This sample uses a function to populate the content of the InfoWindow/Popup.
The function returns HTML that is then populated in each InfoWindow when a feature is selected.
Notice how a link ("Wikipedia Entry") is generated based on the feature selected.

* *
https://developers.arcgis.com/en/javascript/jssamples/popup_chart.html

This sample uses the PopupTemplate class to customize the content of an InfoWindow/Popup.
Using PopupTemplate is quick but may not offer the ammount of customization you require.
(PopupTemplate Documentation: https://developers.arcgis.com/en/javascript/jsapi/popuptemplate-amd.html )

* *
https://developers.arcgis.com/en/javascript/jssamples/fl_popup.html

This is an older sample (non-AMD) that is similar to the first sample but good for reference.

* *

If these samples are too simple for your ultimate needs, you should explore writing your own dijit to replace Popup in the context of your application.
That's what I ended up having to do to.
0 Kudos