We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 01:04 AM

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 08:18 AM

Ah, perfect. Thank you.



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

Hi Mark,


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


Regards,

Pavithra S


Loader.
Live Chat Icon For mobile
Up arrow icon