• Prevent Dialog close on "enter" key

    By Steve Smillie 1 decade ago

    I have a Dialog that contains a text box that users enter a search and a button to update the data for them to choose from.  Problem is if the user types in the text field, and hits the enter key (rather then than clicking the button) it closes the dialog.

    In tried to capture the keypress event code was 13 on the field and that works (I had it do an alert), but it doesn't prevent the dialog close.  I assume this is a dijit.dialog thing but I can't seem to figure how to solve this.

    Thanks!

    • Doesn't happen in the demo DB

      By Philippe Riand 1 decade ago

      Do you have a simple DB that shows it? It might be because your button is a submit button.

      • Does if you add an simple edit box

        By Steve Smillie 1 decade ago

        I added a simple edit box to the Dialog 8.5.2 demo app and if you put the focus into the edit box and hit enter it closes the dialog. I made not other mods to the demo app.

        • Fix provided

          By Philippe Riand 1 decade ago

          The form generated as part of the dialog is now blocking the default submission, which is the right behavior as the submission must be done through an Ajax request (enforced by the dialog class).

          The fix is on SVN and will be in the next build.

          • Thanks

            By Steve Smillie 1 decade ago

            So far it is working better.  Thanks for the effort!!