1

I am using the ArcGIS API for JavaScript to build a web application. Within the web app a geoprocessing service is executed which requires an input that is user dependent.

I thought of a text box where the user can enter a value, which should then be read by the application and used for the geoprocessing service.

How can this be done? I searched on the ArcGIS API website and in the Internet, but I could not find any solution so far.

4

You can do this easily with some HTML by using a text box somewhere in your page or in a modal window:

<input type="text" id="out-folder">

And then for the params of your GP Service in JavaScript:

// set up params
var gpParams = {
    "Boundary": fs,
    "Layer_URL": dom.byId("layer-choice").value,
    "Output_Folder_Name": dom.byId("out-folder").value,  //var from text box is here
    "Include_Features": dom.byId("include-features").checked
}

In my example, I'm using the dojo.dom to get the textbox value, but you can also do this with standard JavaScript like this:

document.getElementById("out-folder").value

I have some very basic examples of using GP services with the JavaScript API here.

  • Thank you for the answer. It should have been accepted. The presentation is really nice! – wondim Nov 26 '17 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.