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

1912
1
04-09-2013 05:07 AM
JasonBewley1
New Contributor
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,
0 Kudos
1 Reply
deleted-user-mezzanRtr2IZ
New Contributor III

I am trying the same approach of passing a variable to to the print layoutOptions using setting the var =  document.getElementById("**").value, but not getting it to work either.  did you find a solution after you posted this question over three years ago?

0 Kudos