AnsweredAssumed Answered

Can't get form/button events from inside a popup, version 4.6

Question asked by DanAncona on Jan 24, 2018
Latest reply on Jan 29, 2018 by DanAncona

I'm trying to get a small form (for adding comments) working in a popup. To do this, I'm trying to add a dom event listener when the popup is visible, but getElementById (aka byId) can't find the button element. This tries to add it whether the popup is visible or not, but you get the idea -"visible", function(visible) {
    console.log("popup visible: ", visible);
    var btn;
    try {
      //view.popup.renderNow(); // seems to do bupkis
      btn = dom.byId("btnAddComment");
      console.log("watch btn is ", btn);
      on(dom.byId("btnAddComment"), "click", function() {
    } catch (err) {
      console.log(btn, err);

The template is super simple, based on the popup intro example -

  var template = { // autocasts as new PopupTemplate()
    title: "Marriage in NY, Zip Code: {ZIP}",
    content: "<button id='btnAddComment'>Add Comment</button>"

I've got a codepen of this if you want to see the rest of the code. Pretty sure I did something like this in 3.x, really not sure why it's not working here. Thanks!