0

I have a form like this HTML:

<div id="dialogGlobal" title="About You">     
  <form>
    <fieldset style="border: none;">
      <ul style="list-style-type: none; padding-left: 0px">
        <li><label for="username">Please Enter Your First Name</label></li>
        <li><input type="text" name="username" id="username" placeholder="Enter your name" pattern="[A-Za-z]{3,}" title="Your first name must be at least 3 letters" class="text ui-widget-content ui-corner-all" required></li>
        <li><label for="zipcode">Please Enter Your Zipcode</label></li>
        <li><input type="text" name="zipcode" maxlength="5" pattern="[0-9]{5}" id="zipcode" title="Please enter a 5 digit zip-code" placeholder="02134" class="text ui-widget-content ui-corner-all" required></li>
      </ul>
    </fieldset>
  </form>
</div>

And the corresponding JQuery-ui javascript

    dialogGlobal = $( "#dialogGlobal" ).dialog({
          autoOpen: false,
          height: 300,
          width: 350,
          modal: true,
        position: {
            my: "center center",
            at: "center center",
            of: "#map"
          },
      buttons: [{
        text: "Submit",
          click: function() {
            if(checkValues();){
               dialogGlobal.dialog("close");
            }
            else{
               alert("Invalid input");
            }
            }
        },
        id: "globalAccept"
      }],
      close: function() {

      },
        //Hack to avoid "ENTER" leading to a new page...
        open: function(){
            $("#dialogGlobal").keydown(function(e) {
              if (e.keyCode == $.ui.keyCode.ENTER) {
                $("#globalAccept").trigger("click");
              }    
            });

        }
    });

When I click on "Submit" in FF and Chrome, everything works fine. In IE 11 (on a Surface RT), nothing happens, I even added an alert that would signal the button was clicked but it doesn't pop up. I tried adding an $("#dialogGlobal").on("click",function(){dothesamething}); but still nothing even though other objects with that listener behave normally....

raphael
  • 2,762
  • 5
  • 26
  • 55
  • is that a click on a touch interface? If yes, did you try $("#dialogGlobal").on("touchstart",function(){dothesamething}) – yezzz May 17 '16 at 20:59
  • @yezzz, good suggestionn but that didn't work :( Other features of the UI work fine on click with... on("click",) so I'm puzzled why this is specific to custom dialog box elements – raphael May 17 '16 at 21:10
  • well I just went to http://jqueryui.com/dialog/#modal-form and it works fine with ie11. Did you check console.log for errors? – yezzz May 17 '16 at 21:23
  • You may also want to set #dialogGlobal to a higher z-index just to confirm it's not some browser rendering issue – yezzz May 17 '16 at 21:28
  • @yezzz that link above worked on the Surface, so I'm going to try to replicate what they were doing there. I think we already set it to the highest z-index due to a previous issue – raphael May 17 '16 at 21:33

1 Answers1

-1

IE may be in compatibility mode. To disable the compatibility mode, add

to your html header

DottedT
  • 183
  • 6