question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot submit form data from source code mode, need to enable WYSIWYG mode

See original GitHub issue

Probably I am find bug… Summernote cannot submit form data from ‘source code’ mode, need to enable WYSIWYG mode for submit form

Example screencast http://screencast.com/t/YZF1AKrBQ

Sample script (modified example file codemirror.html from 0.7.0 release)

<?php
    $data = (!$_POST['summernote']) ? '<b>test</b> sample TEXT' : $_POST['summernote'];
?><!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 
  <title>summernote - codemirror</title>

  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
  <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" />
  <script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script>
  <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css" />
  <link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.min.css" />
  <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/blackboard.min.css">
  <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/monokai.min.css">
  <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/mode/xml/xml.min.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/formatting.min.js"></script>
  <link rel="stylesheet" href="../dist/summernote.css">
  <script type="text/javascript" src="../dist/summernote.js"></script>

  <script type="text/javascript">
    $(document).ready(function() {
      $('.summernote').summernote({
        height: 200,
        tabsize: 2,
        codemirror: {
          theme: 'monokai'
        }
      });
    });
  </script>
</head>
<body>
<pre>
    <?= $data ?>
</pre>
<form method="post">
<textarea class="summernote" name="summernote"><?= $data ?></textarea>
    <input type="submit" value="Send" />
</form>
</body>
</html>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
hackerwinscommented, Dec 27, 2015

@alligator77 Thanks for reporting. You can switch mode with external API.

if ($('.summernote').summernote('codeview.isActivated')) {
  $('.summernote').summernote('codeview.deactivate');
}
3reactions
SCIFcommented, Sep 20, 2021

Hi @lqez ,

Why did you close this issue? It was not solved at all. A few workarounds were suggested but the issue is still there and easily reproducible. A workaround != solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Summernote wysiwyg editor save in codeview not working ...
Try to do something like this. $(document).on("submit","#my-form-name",function(e){ $("#desc").val($('#desc').code()); return true; ...
Read more >
Changes to a block's text field not saved when ckeditor ...
Problem /Motivation On a layout builder page I am seeing data loss when saving an existing block with source mode enabled in ckeditor....
Read more >
Form Troubleshooting and FAQ
I gave my web developer my form's HTML iframe code, but it's not looking right. ... Any time you set a form to...
Read more >
WYSIWYG Editor
If users need to add server-side or client-side code, they should do so by creating a source code asset or inserting it directly...
Read more >
TinyMCE not working: possible causes and fixes
In the event of “tinymce is not defined” or the always fun “Uncaught Reference Error” messages, it usually means that the execution order...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found