0

I am using summernote WYSIWYG editor. From the editor I am taking the html onkey up and putting into the textarea form field as below :

HTML :

      <div class="summernote">
        <textarea rows="1" name="content" id="content" class="required">
           <?= (isset($object))?  $object['content']:set_value('content')?>
        </textarea>
      </div>

JAVASCRIPT :

    var content= $('#content').eq(0).code();        
    $('#content').html(content);
    form.submit();

The http request header's form data section shows content is there with complete editor's data but in essence I'm getting it in the $_POST['content'] as empty string; content="";

Request Payload : Formdata section

Can anyone please help to find what wrong am I making here and WHY Is this happening?

EDIT : After researching a while I have found out that the problem is being caused by codeigniter input class. In this class a method named clean_string() is cleaning off the special charectars (Bengali in my case) before it reaches to the controller!

So I'm just required to escape POST cleaning up in this case only to do it up! Can anyone help please?

edam
  • 910
  • 10
  • 29
  • no redirects along the way/ – Leeish Sep 23 '14 at 22:45
  • @Leeish What do mean brother? – edam Sep 23 '14 at 23:07
  • Does `$_REQUEST["content"]` work? There might be an error with your form enctype. $_POST requires `application/x-www-form-urlencoded` – Johan Karlsson Sep 23 '14 at 23:20
  • Can you show the whole `
    `?
    – Johan Karlsson Sep 23 '14 at 23:39
  • @caeth No please.. It's big enough. Can you please believe me there is nothing as suspectable as another – edam Sep 23 '14 at 23:56
  • @edam :). What does `$HTTP_RAW_POST_DATA` look like? – Johan Karlsson Sep 24 '14 at 00:24
  • I was only wondering if the data is getting posted to page A but page A redirects to page B. Then the post data would get lost on page B as a redirect doesn't carry post data I don't think. However the post data would still show up in Firebug or similar debug. I've never seen this before so I'm totally at a loss. – Leeish Sep 24 '14 at 18:08

1 Answers1

0

Instead of $('#content').html(content); use this:

$('#content').val(content);

.html() doesn't work because you are using a form field.

Tyr
  • 2,810
  • 1
  • 12
  • 21
  • But In the request patload I have the expected data. Please look for this in the attached screenshot in my question. Also I tried with val() .I have been trying since morning :( .It didn't work. – edam Sep 23 '14 at 23:28
  • Then it isn't a problem by sending the content itself. It seems that your server is blocking the size of the field because it exceeds the max size for input fields. The default size for input fields is 1000 characters. – Tyr Sep 23 '14 at 23:55
  • Is there no difference between a textarea field and an input field? – edam Sep 23 '14 at 23:58
  • All textfields are technically "input" fields (server side), regardless of their name. Add max_input_size = 5000 to your php.ini file. – Tyr Sep 23 '14 at 23:59
  • That's not true! I have just saved 7000 char (even those were unicode chars) with a text field just now! – edam Sep 24 '14 at 00:03
  • @Tyr, php has a default max post limit of 2MB so the size of the input shouldnt matter unless it is at or over that 2MB limit, unless the server software like apache is invoking a limit – Patrick Evans Sep 24 '14 at 00:38
  • @PatrickEvans Yeah, I thought that were causing the problem initially. But When I looked into my php.ini I have found out the max_post_size = 8M . – edam Sep 24 '14 at 01:15
  • The only thing that comes in my mind is some sort of this: http://stackoverflow.com/a/5078426/4066269 – Tyr Sep 24 '14 at 01:22