<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: wiring a button click event in an InfoWindow in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232977#M21744</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I sorta just came up with a workaround, right after making the post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when using the setContent method, at the end of the content I have the string:&lt;/P&gt;&lt;P&gt;{$OBJECTID:myFunction}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, within myFunction I can wire the click event with my button id to an anonymous function that prints test to the console.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems rediculous but it works.&amp;nbsp; Still don't get why my 2nd example in the original question doesn't just work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Jun 2015 16:00:13 GMT</pubDate>
    <dc:creator>JosephRogan</dc:creator>
    <dc:date>2015-06-05T16:00:13Z</dc:date>
    <item>
      <title>wiring a button click event in an InfoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232976#M21743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have InfoWindow popups when users clicks a layer on my map.&amp;nbsp; I am doing a lot of custom formating in these info windows and require having a html button in them.&amp;nbsp; I can get the button to appear no trouble, but I can't get it's click event to work or call a function in my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried multiple approaches including using:&lt;/P&gt;&lt;P&gt;&amp;lt;button id='myButton' onclick='myFunction();'&amp;gt;Label&amp;lt;/button&amp;gt; &lt;/P&gt;&lt;P&gt;when I create the button in the InfoTemplate.setContent method.&amp;nbsp; Doing this tells my that my function is undefined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also tried wiring the event in multiple location such as by using:&lt;/P&gt;&lt;P&gt;on(dom.byId("myButton", "click", function() {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("test");&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;But nothing happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 15:53:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232976#M21743</guid>
      <dc:creator>JosephRogan</dc:creator>
      <dc:date>2015-06-05T15:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: wiring a button click event in an InfoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232977#M21744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I sorta just came up with a workaround, right after making the post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when using the setContent method, at the end of the content I have the string:&lt;/P&gt;&lt;P&gt;{$OBJECTID:myFunction}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, within myFunction I can wire the click event with my button id to an anonymous function that prints test to the console.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems rediculous but it works.&amp;nbsp; Still don't get why my 2nd example in the original question doesn't just work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 16:00:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232977#M21744</guid>
      <dc:creator>JosephRogan</dc:creator>
      <dc:date>2015-06-05T16:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: wiring a button click event in an InfoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232978#M21745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joseph,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know this code is not quite what you are looking for, in this script a html link is added and performs a function when clicked. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/message/459489"&gt;Data Grid Related Records Zoom&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 16:00:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232978#M21745</guid>
      <dc:creator>RickeyFight</dc:creator>
      <dc:date>2015-06-05T16:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: wiring a button click event in an InfoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232979#M21746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With the &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;lt;button id='myButton' onclick='myFunction();'&amp;gt;Label&amp;lt;/button&amp;gt; approach, how are you defining the function?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;function myFunction(){&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; //this will probably be undefined&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Instead try:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;window.myFunction = function(){&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; //this may work&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:47:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wiring-a-button-click-event-in-an-infowindow/m-p/232979#M21746</guid>
      <dc:creator>KristianEkenes</dc:creator>
      <dc:date>2021-12-11T11:47:09Z</dc:date>
    </item>
  </channel>
</rss>

