<?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: Communication between widget.js and widget.html in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10909#M265</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert works like a charm!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would I do if I have more than one button and text fields?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Feb 2015 20:09:27 GMT</pubDate>
    <dc:creator>TimWitt2</dc:creator>
    <dc:date>2015-02-11T20:09:27Z</dc:date>
    <item>
      <title>Communication between widget.js and widget.html</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10905#M261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I create a textbox or a button in my widget.html file, how can I access these in my widget.js file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example if I create a button in my widget.html file with the id="TestButton", how would I write a button click event in my widget.js file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 19:37:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10905#M261</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-02-11T19:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Communication between widget.js and widget.html</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10906#M262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Just use&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;on(this.TestButton, 'click', lang.hitch(this, function(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp; //todo
}));&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:28:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10906#M262</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-10T20:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Communication between widget.js and widget.html</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10907#M263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the following error:&lt;/P&gt;&lt;P&gt;fail to open widget Demo. TypeError: Cannot read property 'on' of undefined&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have in my widget.js&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;define(['dojo/_base/declare', 'jimu/BaseWidget', 'dojo/dom', "dojo/on",'dojo/_base/lang'],
function(declare, BaseWidget, dom, on, lang) {
&amp;nbsp; //To create a widget, you need to derive from BaseWidget.
&amp;nbsp; return declare([BaseWidget], {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // DemoWidget code goes here 


&amp;nbsp;&amp;nbsp;&amp;nbsp; //please note that this property is be set by the framework when widget is loaded.
&amp;nbsp;&amp;nbsp;&amp;nbsp; //templateString: template,


&amp;nbsp;&amp;nbsp;&amp;nbsp; baseClass: 'jimu-widget-demo',


&amp;nbsp;&amp;nbsp;&amp;nbsp; postCreate: function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.inherited(arguments);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('postCreate');
&amp;nbsp;&amp;nbsp;&amp;nbsp; },


&amp;nbsp;&amp;nbsp;&amp;nbsp; startup: function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.inherited(arguments);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.mapIdNode.innerHTML = 'map id:' + this.map.id;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('startup');
&amp;nbsp;&amp;nbsp;&amp;nbsp; },


&amp;nbsp;&amp;nbsp;&amp;nbsp; onOpen: function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('It is open, come on in!');
&amp;nbsp;&amp;nbsp; on(this.clear, 'click', lang.hitch(this, function(evt){&amp;nbsp; 
&amp;nbsp; console.log("It is clear!")
&amp;nbsp; }));


&amp;nbsp;&amp;nbsp;&amp;nbsp; },


&amp;nbsp;&amp;nbsp;&amp;nbsp; onClose: function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('onClose');
&amp;nbsp;&amp;nbsp; var test = this;
&amp;nbsp;&amp;nbsp;&amp;nbsp; },


&amp;nbsp;&amp;nbsp;&amp;nbsp; onMinimize: function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('onMinimize');
&amp;nbsp;&amp;nbsp;&amp;nbsp; },


&amp;nbsp;&amp;nbsp;&amp;nbsp; onMaximize: function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('onMaximize');
&amp;nbsp;&amp;nbsp;&amp;nbsp; },


&amp;nbsp;&amp;nbsp;&amp;nbsp; onSignIn: function(credential){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* jshint unused:false*/
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('onSignIn');
&amp;nbsp;&amp;nbsp;&amp;nbsp; },


&amp;nbsp;&amp;nbsp;&amp;nbsp; onSignOut: function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('onSignOut');
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp; });
});&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here is what I have in my widget.html:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;div&amp;gt;
&amp;lt;button id="clear" data-dojo-type="dijit/form/Button" type="button" data-dojo-attach-point="button"&amp;gt;Clear All&amp;lt;/button&amp;gt; 
&amp;lt;/div&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas what I did wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:28:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10907#M263</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2021-12-10T20:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Communication between widget.js and widget.html</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10908#M264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Use the dojo attach point name and not the dom id.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;on(&lt;SPAN class="keyword"&gt;this.button, &lt;SPAN class="string"&gt;'click'&lt;/SPAN&gt;, lang.hitch(&lt;SPAN class="keyword"&gt;this&lt;/SPAN&gt;, function(evt){&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(&lt;SPAN class="string"&gt;"It is clear!")&lt;/SPAN&gt;
}));&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:28:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10908#M264</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-10T20:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Communication between widget.js and widget.html</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10909#M265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert works like a charm!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would I do if I have more than one button and text fields?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 20:09:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10909#M265</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-02-11T20:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Communication between widget.js and widget.html</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10910#M266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Give each control a unique data-dojo-attach-point name. You can also add the event handler stuff directly in the html template.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data-dojo-attach-point="list" data-dojo-attach-event="click:_selectResultItem,mouseover:_overResultItem,mouseout:_outResultItem"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 20:14:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10910#M266</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-02-11T20:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Communication between widget.js and widget.html</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10911#M267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert that makes sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 20:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/communication-between-widget-js-and-widget-html/m-p/10911#M267</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-02-11T20:16:29Z</dc:date>
    </item>
  </channel>
</rss>

