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
close icon

When edited prevent actions

Is it possible to display some alert, confirm or syncfusion dialog while rte was edited and user try to redirect from page or clicked to open other tab?
Thank you

1 Reply

PO Prince Oliver Syncfusion Team April 9, 2019 05:57 AM UTC

Hi Mihael,  
 
Thanks for contacting us. 
 
Yes , you can display confirmation dialog through change event of RTE, when RTE is edited and its value is changed. If you wish you to check for certain keypress and display a confirmation dialog , then you can perform this using keyDown event of RTE. Kindly refer the following code. 
 
@{Html.EJ().RTE("rteSample").ClientSideEvents(e=>e.Keydown("onKeyDown").Change("onChange")).Width("100%").Height("380px").ContentTemplate(@<div> 
        <p><b>Description:</b></p> 
        <p> 
            The Rich Text Editor (RTE) control is an easy to render in 
            client side. Customer easy to edit the contents and get the HTML content for 
            the displayed content. A rich text editor control provides users with a toolbar 
            that helps them to apply rich text formats to the text entered in the text 
            area. 
        </p> 
        <a rel='nofollow' href="https://mvc.syncfusion.com/demos/web/rte/default" >Demo link for RTE </a> 
    </div>).MinWidth("200px").Render();} 
<script> 
    function onChange(args) { 
      console.log(args.value) 
    } 
    function onKeyDown(args) { 
        if (args.keyCode == 17) { 
            var check = confirm("Please click OK for navigation to demo page.") 
            if (check) 
                window.location = "https://mvc.syncfusion.com/demos/web/rte/default"; 
        } 
    } 
</script> 
 
We have attached a sample for your reference, please find the sample at the following location: 
 
For further reference on the available events in RTE, please refer the following UG document 
 
Note: In our sample, we have just displayed a confirmation dialog to show alert before navigating from the anchor link. You can also render our Syncfusion Dialog with required content for this case and show or hide through show/hide methods based on the requirement. Kindly refer to the below UG documentation links: 
 
Let us know if you need any further assistance on this. 
 
Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon