Select to view content in your preferred language

ArcGIS API Question - Submit polygons and an html form

3270
3
Jump to solution
12-04-2015 07:43 AM
BradVilla
Deactivated User

So my team and I are working with the ArcGIS Javascript API.

We have a special need... We need to draw polygons on a map with an attached infoWindow that contains one editable drop-down field, fill out a separate HTML form on the same page (a non-arcgis html form) and submit the polygons (to a Feature Service) and the form (to a separate non-spacial table) with the same form submit button. The main goal is to prevent polygons from saving to the Feature Service until the HTML form has been submitted. We are not using any ArcGIS Widgets in our application.

My problem is, I can create a polygon but I want to have that infoWindow popup on "draw-complete" so I can edit the polygon's attribute. I cant seem to create an infoTemplate/attributeInspector on newly drawn geometry. This has something to do with the GrahpicsLayer and all the examples I find are dealing with a FeatureLayer.

Does anyone have any clue on what I should do?

I have looked at the following samples on the ArcGIS API site and several others that are not worth mentioning.

For saving the new polygons - Using the attribute inspector | ArcGIS API for JavaScript 

For drawing/editing polygons - Edit without editor widget | ArcGIS API for JavaScript

Thank you very much for reading my plea!

Brad

0 Kudos
1 Solution

Accepted Solutions
thejuskambi
Frequent Contributor

Hello Brad,

I think you can use a FeatureService to create a FeatureLayer, you dont need to use GraphicLayer. It may not be possible to use AttributeInspector on GraphicsLayer, as it is client only and does not have method or applying edits. also some required information like fields etc does not exist.

If you must use GraphicsLayer, I would suggest you use "infoWindow.setContent" to build a form like display and save the updated attributes to the graphic. You can then save it as json string till the user has completed filling the other non-gis form and save is by called the rest endpoints of the FeatureService.

Hope this was helpful.

Warm Regards,

Thejus

View solution in original post

3 Replies
RickeyFight
MVP Regular Contributor

Brad,

I would suggest moving this to ArcGIS API for JavaScript

Secondly have you seen this:

GeoForm

BradVilla
Deactivated User

Thanks Rickley Fite! I will take a look at the GeoForm and move this thread to the right place.

0 Kudos
thejuskambi
Frequent Contributor

Hello Brad,

I think you can use a FeatureService to create a FeatureLayer, you dont need to use GraphicLayer. It may not be possible to use AttributeInspector on GraphicsLayer, as it is client only and does not have method or applying edits. also some required information like fields etc does not exist.

If you must use GraphicsLayer, I would suggest you use "infoWindow.setContent" to build a form like display and save the updated attributes to the graphic. You can then save it as json string till the user has completed filling the other non-gis form and save is by called the rest endpoints of the FeatureService.

Hope this was helpful.

Warm Regards,

Thejus