Select to view content in your preferred language

Creating a Button to Activate Popup - Issue

1477
1
04-28-2016 09:06 AM
IanPeebles
Frequent Contributor

I have a popup that works well within the application.  However, my goal is to tied the popup to a button, where the user must click on the button to activate the popup.  I keep getting an error in console mode that states" unexpected identifier and the button does not fire the popup.  I have two files, an index.htm and the infoTemplate.js file.  Here are snippets of my code:

index.htm

<script src="js/infoTemplate.js"></script>

<!-- Required Application Modules -->
require([
  "dojo/on",
  "dijit/registry",
  "dojo/dom"
], function(
   on,

   registry,
   dom
)

  // Code Application Function
  on(dom.byId("btnActivatePopup"), "click", activatePopup);

DIV section

<button id="btnActivatePopup">PopUp</button>

infoTemplate.js

require([
  "esri/dijit/Popup",
  "esri/dijit/PopupTemplate"
], function(
  Popup,
  PopupTemplate
)

function activatePopup() {

<all of the popup template code in here>

}

What is it that I am missing?  Any assistance will be appreciated.  Thanks.

0 Kudos
1 Reply
williamcarr
Frequent Contributor

Ian,

Are you trying to create the domNode on the button click or just populate it? I use a button click to populate/remove content from an info widow using a domStyle toggle.

To toggle Off:

domStyle.set(query(".actionList > .action.sForm", window.map.infoWindow.domNode)[0], "display", "none");

To toggle On:

domStyle.set(query(".actionList > .action.sForm", window.map.infoWindow.domNode)[0], "display", "");

Don't know if that helps any.

0 Kudos