Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4321142
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:42:39+00:00 2026-05-21T08:42:39+00:00

I am trying to catch a form submission with jquery that is submitted via

  • 0

I am trying to catch a form submission with jquery that is submitted via pressing save in ck editor.

My javascript code is

$(function() {
    var config = {
        skin : 'office2003',
        toolbar :[
            ['Save','Preview'],
            ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'],
            ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
            ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
            ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
            ['Link','Unlink'],
            ['Image','Table','HorizontalRule','SpecialChar','Iframe'],
            ['Format','Font','FontSize'],
            ['TextColor','BGColor', 'Bold','Italic','Underline','Strike','-','Subscript','Superscript']
        ]
    };
    $('#cont').ckeditor(config);

    $('form').submit(function() {
        var form = $(this);
        var name = form.children('#name').val();
        var desc = form.children('#desc').val();
        var cont = form.children('#cont').val();
        var id = form.children('#id').val();

        $.ajax({
            url: basePath + 'admin/ajax/pages/edit',
            type: 'POST',
            data: {
                name: name,
                desc: desc,
                cont: cont,
                id:   id
            },
            success: function(data) {
                if (data.response)
                    $('#ajaxSuccess').show('fast').delay(10000).hide('fast');
                else
                    $('#ajaxError').show('fast').delay(10000).hide('fast');

            },
            error: function(data) {
                $('#ajaxError').show('fast').delay(10000).hide('fast');
            }
        });
        return false;

    });

});

But for some reason the submit handler doesn’t even seem to be called (tested via alert('called'); as first line), instead the form is submitted normally.

What am I doing wrong?


Based on the answer below I have updated my code to be

$(function() {
    var saveCmd = {
        modes : { wysiwyg:1, source:1 },
        exec : function( editor ){
            jQuery($form = editor.element.$.form).submit();
        }
    };

    var pluginName = 'safesave';

    // Register a plugin named "save".
    CKEDITOR.plugins.add(pluginName, {
        init : function( editor ){
            var command = editor.addCommand( pluginName, saveCmd );
            command.modes = { wysiwyg : !!( editor.element.$.form ) };

            editor.ui.addButton( 'SafeSave',{
                label     : editor.lang.save,
                command   : pluginName,
                className : 'cke_button_save'
            });
        }
    });


    var config = {
        skin : 'office2003',
        toolbar :[
            ['SafeSave','Preview'],
    ...

But now I have no save button, whats up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:42:39+00:00Added an answer on May 21, 2026 at 8:42 am

    Yeah, you can’t. You need a different save module. I wrote this for this exact purpose:

    (function(){
        var saveCmd = {
            modes : { wysiwyg:1, source:1 },
            exec : function( editor ){
                jQuery($form = editor.element.$.form).submit();
            }
        };
    
        var pluginName = 'safesave';
    
        // Register a plugin named "save".
        CKEDITOR.plugins.add(pluginName, {
            init : function( editor ){
                var command = editor.addCommand( pluginName, saveCmd );
                command.modes = { wysiwyg : !!( editor.element.$.form ) };
    
                editor.ui.addButton( 'SafeSave',{
                    label     : editor.lang.save,
                    command   : pluginName,
                    className : 'cke_button_save'
                });
            }
        });
    })();
    

    Now just change your command from save to SafeSave. Not sure why I called it SafeSave, maybe I was tired like I am now 🙂

    Note that this depends on jQuery. If you aren’t using jQuery, change the exec function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to thread this below function so that the background form can continue
I am trying to catch redirect response of asp.net from client-side by javascript/jquery but
I am trying to start a thread in a form for a function that
Hi I am am trying to catch mouse movements for a MouseOver function in
I'm using Cognos and I'm trying to catch the enter key so that the
I'm trying to write some code to catch all Errors and ErrorEvents however i
I'm trying to create a web form that contains checkboxes, among other input elements,
I'm trying to automate form submission using Java to get the hours of a
In ASP JavaScript I am trying to form a statement (possibly an if statement)
I am trying to achieve a subsequent form submission. To clarify things - I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.