Prevent Dialog Submit on Enter

For a grid that is using dialog mode for edit, how can you prevent the form submission when a user hits enter in a control? 


3 Replies

PS Pavithra Subramaniyam Syncfusion Team October 10, 2022 06:04 AM UTC

Hi Mark,


Thanks for contacting Syncfusion support.


You can prevent the form submission on enter the key inside the “actionComplete” event with “beginEdit” request type. Please refer to the below code example, API, and sample link for more information.


actionComplete: (args) => {

    if (args.requestType == 'beginEdit') {

      args.form.addEventListener('keydown'function (e) {

        if (e.key === 'Enter') {

          e.stopPropagation();

        }

      });

    }

  },

 


API        : https://ej2.syncfusion.com/javascript/documentation/api/grid/#actioncomplete


Sample : https://stackblitz.com/edit/p8fpxi?file=index.js


Please get back to us if you need further assistance on this.


Regards,

Pavithra S



MA Mark October 10, 2022 01:18 PM UTC

Ah, perfect. Thank you.



PS Pavithra Subramaniyam Syncfusion Team October 11, 2022 05:31 AM UTC

Hi Mark,


Welcome! Please get back to us if you need further assistance.


Regards,

Pavithra S


Loader.
Up arrow icon