AnsweredAssumed Answered

Add button to infoWindow to pass graphic to another function

Question asked by crackernutter on May 5, 2012
Latest reply on May 6, 2012 by crackernutter
I'm trying to add a button to an infoWindow - when the button is clicked, it should pass the graphic to the supporting function.  Everything works but the graphic isn't passed...
function twitterPopup(evt){     var graphic = evt.graphic;   var attr = graphic.attributes;   var newDate = (attr.created_at).replace('+0000', 'UTC');   var content = '';   if (attr.profile_image_url) {         content = '<a class="twImage" href="http://twitter.com/' + attr.from_user + '" target="_blank"><img class="shadow" src="' +    attr.profile_image_url + '" width="48" height="48"></a>';   }  content += '<p>' + replaceURLWithLinks(attr.text) + '</p>';  content += '<div class="clear"></div><ul class="iwContentList"><li><b>Location:</b> (' + attr.geo.coordinates + ')</li><li><b>Created:</b> ' + newDate + '</li></ul></div><br/>';  content += '<div align="center"> <input value="Add to Database" id = "add" type="button" onClick="addTwitterToDatabase(this.graphic)"></input></div>'  var title = attr.from_user + " tweets&hellip;";     map.infoWindow.resize(300,230);     map.infoWindow.setTitle(title);     dojo.byId('infoWindowContents').innerHTML = content;     $('#infoWindowContents a').each( function() {         $(this).attr('target', '_BLANK');     });     esri.show(dojo.byId("infoWindowContents"));  var screenPoint = evt.screenPoint;     map.infoWindow.show(evt.graphic.geometry, map.getInfoWindowAnchor(screenPoint)); }

Does anyone have any suggestions?  I've tried passing graphic, and this.graphic, but the passed parameter remained undefined in the addTwitterToDatabase function.  As it the function isn't passing anything at all....

Thanks, Jay

Outcomes