AcceptsReturn property is not working.

Greetings!

I have EditControl within a window dialog with a button set to IsDefault="true".
I set AcceptsReturn for EditControl to "true", but every time I press Enter instead of new line I get dialog submit.

Can you help with that?

Thank you in advance.

7 Replies 1 reply marked as answer

UN Unknown Syncfusion Team July 29, 2020 12:27 PM UTC

Hi Aleksander, 

Thanks for contacting Syncfusion support. 

We have checked your query “Need to prevent enter to invoke button click when Enter key is pressed inside EditControl and IsDefault is enabled for button” and created a sample to meet your requirement please refer the below for same. 


Regards, 
Niranjan Kumar Gopalan 



AZ Aleksander Zotov July 29, 2020 01:09 PM UTC

Hi!

Thank you for a quick answer.
Unfortunately this not really sutable for my situation.
Is it possible not to use button's name? I assume that typical AcceptsReturn behavior is not implemented into control?


AP Aiswarya Patturaja Syncfusion Team July 31, 2020 03:45 PM UTC

Hi Aleksander
Greetings from Syncfusion support. 
Query 1: 
 Since `IsDefault` property registers the Button with AccessKeyManager, click event invoked independent of the focused control. You may face the same behavior in TextBox also. We could able to restrict the window closing by  
Query 2: 
AcceptReturn property in EditControl working our side, for further details please refer the sample provided in below link. If you still facing issues with AcceptReturn behavior, reproduce it in below sample and revert us. 
Please let us know if need further assistance.    
 
Regards, 
Aiswarya 
 



AZ Aleksander Zotov July 31, 2020 05:07 PM UTC

Thank you!

Unfortunatelly I cannot use second link at all. 
It says:
Access Denied
You don’t have permission to access this file. 


SK Senthil Kumaran Rajan Syncfusion Team August 3, 2020 06:39 AM UTC

Hi Aleksander, 
 
Thank you for your update. 
 
We can suppress the button click event to be triggered while pressing on enter key in EditControl by using the property named EnterKeyBehavior. We have modified the sample for your reference and this can be downloaded from below location. 
 
Code Snippet[C#] 
 
this.editControl1.EnterKeyBehavior = Syncfusion.Windows.Edit.EnterKeyBehavior.AddNewLineFeed; 
 
 
Regards, 
Senthil 


Marked as answer

AZ Aleksander Zotov August 6, 2020 01:04 PM UTC

Thank you very much!

It worked.


UN Unknown Syncfusion Team August 7, 2020 02:40 AM UTC

Hi Aleksander, 
 
Thanks for your update. 
 
We are glad to know that the reported query has been resolved at your end. Have a good day! 
 
Regards, 
Niranjan Kumar Gopalan 


Loader.
Up arrow icon