This is a migrated thread and some comments may be shown as answers.

OnClientSubmit - Stop Submission

2 Answers 28 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Dan Ehrmann
Top achievements
Rank 1
Dan Ehrmann asked on 27 Mar 2014, 03:57 PM
I am performing a test on the editor content in OnClientSubmit. I would like to prevent the submit if the test fails. Is it possible to do this?

2 Answers, 1 is accepted

Sort by
0
Dan Ehrmann
Top achievements
Rank 1
answered on 27 Mar 2014, 04:26 PM
replying to myself...

I should add that I have resolved this by replacing the __doPostBack function to add my test. I just wonder if there is a way to do this without this extra code.
$(document).ready(function () {
    var originalDoPostBack = __doPostBack;
    __doPostBack = function (target, args) {
        if (hasBadContent(editor.get_html(false))) {
            return;
        }
        originalDoPostBack(target, args);
    }
0
Ianko
Telerik team
answered on 28 Mar 2014, 09:43 AM
Hello Dan,

The proper approach is using a CustomValidator control, which cancels the submit upon to implemented logic.  The editor by itself cannot cancel the submitting and such behavior would be faulty.

I suggest examining this live example which demonstrates the integration of the CustomValidator with the RadEditor control.

Regards,
Ianko
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Editor
Asked by
Dan Ehrmann
Top achievements
Rank 1
Answers by
Dan Ehrmann
Top achievements
Rank 1
Ianko
Telerik team
Share this question
or