I am trying to create a mobile application for field use, but the pop-up editor is too small. It's discussed here in this blog: Editing pop-UPs got you DOWN? | ArcGIS Blog
Are there any tutorials that cover how to do this in the Esri JS API?
Solved! Go to Solution.
You might also want to take a look at this sample:
There is some good info on divintohtml5 about creating forms that make it easy for users on mobile devices to input info.
Basically you just want to create a form and then when users enter the info and click some form of submit button you use the Feature Layer applyEdits method to write the attribute info to the service. I think I sent you the code to the Graffiti app? If so that app uses a custom form and applyEdits to add a feature so its one example of how to accomplish the task.
You did send me that code, but I just didn't know how to integrate the code into my app. I am just trying to understand how to make the edits apply to the feature service and I am not getting it. The editing widget does it all for you.
So if you aren't using the editor you need to handle the updates. You can do so using FeatureLayer.applyEdits. The Edit without Editor sample in the help shows how this works. Basically you create a new graphic using the input geometry and assign the attribute (which you get from the form).
var attr = { "email": dom.byId("report_email").value || null, "description": dom.byId("report_desc").value || null, "date": dom.byId("report_date").value || null }; graphic.setAttributes(attr); graphic.setAttributes(attr);
Then use applyEdits to add the feature.
featureLayer.applyEdits([graphic], null, null.......
Just one question on this one. How do I determine the feature that was clicked on?
You'll want to listen for the feature layer's click event. Here's an example:
layer.on("click", function(evt) {
event.stop(evt);
if (evt.ctrlKey === true || evt.metaKey === true) { //delete feature if ctrl key is depressed
layer.applyEdits(null,null,[evt.graphic]);
currentLayer = this;
editToolbar.deactivate();
editingEnabled=false;
}
});
});
Thanks Kelly Hutchins I've got a lot to learn in editing. I hope it gets easier with practice. But this helps.
Kelly Hutchins I had one more question on this. I think it relates, so I didn't create a new thread. I want to populate the form when the user clicks on a point for editing. What would I need to write to get the information for the individual fields, like if a field was named: PipeId and the form was named pipeId?
You might also want to take a look at this sample:
I like the answer before this one best, but I need to learn bootstrap. Needing to learn what causes the form to pop-up. But I'm going to try and modify this one for my project. Thanks.