3

I have a form in laravel (not using blade) using CKEditor. I am trying to get the content from it in a div called editorcontents when I submit the form as it is submitting a blog post (so it needs to have the formatting from that div as well).

I tried assigning a name to the div, but no luck. How can I use the div just as a input field?

<div id="editorcontents" name="editorcontents">
</div>

$content = Input::get('editorcontents');
return $content;
6
  • Have you try use ajax to post value of div :) Commented Oct 30, 2014 at 18:18
  • Trying to stay away from ajax for this one. I can do it with ajax, but I have been told to stick to PHP. Commented Oct 30, 2014 at 18:19
  • are you function of CKEditer is running yet ?? Commented Oct 30, 2014 at 18:23
  • CKEditor is running in JQuery, but for passing stuff I have been told to use PHP, so I want to stick to that. Commented Oct 30, 2014 at 18:25
  • can you give me a sample form you try into jsfiddle.net Commented Oct 30, 2014 at 18:31

1 Answer 1

1

Try this with ajax in jQuery to get html content of editorcontents and post this to controller in server :) ... I hope this help

Html

<div id="editorcontents" name="editorcontents">
</div>

Jquery

    var inputValue = $("#editorcontents").html;     
    $.ajax( {
        type : "POST",
        cache : false,
        async : true,
        global : false,
        url : "URL POST DATA",
        data : {
            editorcontents : escape(inputValue),
        }
    } ).done( function ( data )
    {   
        //Handle event send done;
    } )
Sign up to request clarification or add additional context in comments.

7 Comments

I am trying to stay away from ajax, but in this case, how long can the string for editorcontents be? Because I originally tried to use it, but it returned nothing if the string was too long
But when trying to post +- 1000 lines it sent an empty string instead?
have you setting : php_value post_max_size
I have edited my answer: editorcontents : escape(inputValue)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.