isc11

Setting Title Text,AuthorText via HTML Text boxes in Print Dijit

Discussion created by isc11 on Apr 9, 2013
Latest reply on May 2, 2016 by mayja02
What I'm trying to do is the following:

I have html text boxes that the user can input the title information and etc. I'm trying to figure out how to pass those text values into the layoutOptions portions of my print dijit templates.

For example, I have the following HTML text input box:
Map Title:<input type="text" id="mapTitle" />


I can get the value of that field via, 
document.getElementById('mapTitle').value


I'm not sure how to push that value into the appropriate place in the template code.

var printer = new esri.dijit.Print({
      map: map,
      url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",
      
      templates:  [{
       label: "Map Only - PDF",
       format: "PDF",
       layout: "MAP_ONLY",
       exportOptions: {
         width: 1500,
         height: 1400,
         dpi: 150
       }
     }, {
       label: "PDF - Layout",
       format: "PDF",
       layout: "A4 Portrait",
       layoutOptions: {
         titleText: PASSED IN VALUE,
         authorText: PASSED IN VALUE,
         copyrightText: PASSED IN VALUE,
         scalebarUnit: "Miles",
        }
     },{
       label: "JPG - Layout",
       format: "JPG",
       layout: "A4 Portrait",
       layoutOptions: {
         titleText: PASSED IN VALUE,
         authorText: PASSED IN VALUE,
         copyrightText: PASSED IN VALUE,
         scalebarUnit: "Miles",
       }
     },]
    }, dojo.byId("printButton"));
    printer.startup();


I tried what I consider the obvious, which is declaring a variable and then passing in the variable:
var userMapTitle = document.getElementById('mapTitle').value;

layoutOptions: {
      titleText: userMapTitle ,
      authorText: PASSED IN VALUE,
      copyrightText: PASSED IN VALUE,
      scalebarUnit: "Miles",
   }


But, that did not work.

Thanks in advance,

Outcomes